Friday, September 19, 2014

Installing docker (not so obvoius)

I was trying to explore docker (mainly to see and understand if docker would be a better choice for my project ..currently i am using vagrant ) and the first step was to install docker.

and something unexpected happened


so my steps were:-
1. install docker  (this turned out to be wrong docker)

sudo apt-get install docker
2. run the first command from the tutorial ( i doubled checked multiple tutorials to make sure the command was right )
sudo docker run -t -i ubuntu:14.04 /bin/bash

3. but things were not working ..It could not recognise the flags (-t, -i)  hence started the troubleshooting ( you generally don't expect to run into issues on the first command..)

after some debugging i found that IT IS THE WRONG DOCKER!!! ( imagine that :))


more details here :-
http://stackoverflow.com/questions/20018736/docker-opens-up-a-tiny-new-window-that-does-nothing


anyways what i did was ultimately

4. remove unwanted docker (you can verify that its the unwanted on by coker --help)
 docker --help  
 sudo apt-get remove docker


5. now if you have ubuntu 14:0 then this should work :-
$ sudo apt-get update
$ sudo apt-get install docker.io
$ sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
$ sudo sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io 
6. But if you have an older ubuntu these instructions will help :-

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D8576A8BA88D21E9  
 $ sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"  
 $ sudo apt-get update  
 $ sudo apt-get install lxc-docker  
 $ sudo docker version  
 Client version: 0.9.0  
 Go version (client): go1.2.1  
 Git commit (client): 2b3fdf2  
 Server version: 0.9.0  
 Git commit (server): 2b3fdf2  
 Go version (server): go1.2.1  
 Last stable version: 0.9.0  
 $ sudo docker search ubuntu | grep '^ubuntu'  
 ubuntu   General use Ubuntu base image. Tags availa...  108  
 ubuntu-upstart                       0  
 ubuntu/ping 
 
 
 
7. to know things are working ... you should see something like this:- 
 0  
root@njain2:~/office/projects# sudo docker run -t -i ubuntu:14.04 /bin/bash
Unable to find image 'ubuntu:14.04' locally
Pulling repository ubuntu
96864a7d2df3: Error pulling image (14.04) from ubuntu, endpoint: https://registry-196864a7d2df3: Error pulling image (14.04) from ubuntu, Error mounting '/dev/mapper/docker-202:2-1501557-511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158' on '/var/lib/docker/devicemapper/mnt/511136ea3c5a64f264b78b5433614aec563103b4d42014/09/19 12:55:20 Error pulling image (14.04) from ubuntu, Error mounting '/dev/mapper/docker-202:2-1501557-511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158' on '/var/lib/docker/devicemapper/mnt/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158': device or resource busy
root@njain2:~/office/projects# pwd
/root/office/projects
root@njain2:~/office/projects# cd event-notification/ 



8. In case things are not working (due to device mapper errors) 
use AUFS instead of device mapper ( you can detect this by "sudo docker info"
$ sudo apt-get update
$ sudo apt-get install linux-image-extra-`uname -r`
$ sudo apt-get purge --auto-remove lxc-docker 
$ sudo apt-get install lxc-docker
$ buzzenv)njain@njain3:~/office/buzz$ sudo docker info
Containers: 1
Images: 7
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Dirs: 9
Execution Driver: native-0.2
Kernel Version: 3.2.0-60-virtual
Operating System: Ubuntu precise (12.04.4 LTS)
you should not see device mapper in docker info :) and you are good to go 
 
 
 

Wednesday, September 10, 2014

dependency on pyopenssl and "gcc failed with exit status 1" issue


I have a script that listens to APNS feedback service to get invalid tokens (https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9)


when i ran into a ubuntu box (spun by vagrant ) i ran into this issue:-


  
 raise DistutilsError("Setup script exited with %s" % (v.args[0],))

distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1




So I read online that probably i need to fix pyopenssl   hence i tried 
Pip install pyopenssl 

 raise DistutilsError("Setup script exited with %s" % (v.args[0],))

distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

After that i tried easyinstall to understand more on whats going on and i got 


    No package 'libffi' found c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory #include "
 
 
You'll need to install the libffi-devel package  

                   "sudo apt-get install libffi-dev"

vagrant ssh on windows : `ssh` executable not found in any directories in the %PATH% variabl

if your vagrant ssh compliants about this :-

H:\office projects\event-notification>vagrant ssh
`ssh` executable not found in any directories in the %PATH% variable. Is an
SSH client installed? Try installing Cygwin, MinGW or Git, all of which
contain an SSH client. Or use your favorite SSH client with the following
authentication information shown below:

Host: 127.0.0.1
Port: 2222
Username: vagrant
Private key: sdfdsf


simple solution is :-


set PATH=%PATH%;C:\Program Files (x86)\Git\bin