Wednesday, March 16, 2016

Docker installation on Linux

Install Docker
 https://docs.docker.com/linux/

$ curl -fsSL https://get.docker.com/ | sh
$ curl -fsSL https://get.docker.com/gpg | sudo apt-key add - 
$ docker run hello-world 
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'. 

Fix for this problem:
http://stackoverflow.com/questions/25404597/cannot-connect-to-the-docker-daemon-is-docker-d-running-on-this-host

After running the command below log out and log back in.
sudo usermod -aG docker 

Rerun the Docker hello world command. The command should work now.
docker run hello-world

Rerun the Docker hello world command. The command should work now.
docker run hello-world
 
Install docker-machine
https://docs.docker.com/machine/

sudo curl -L https://github.com/docker/machine/releases/download/v0.6.0/docker-machine-`uname -s`-`uname -m` > docker-machine
sudo cp docker-machine /usr/local/bin/docker-machine
 
sudo chmod +x /usr/local/bin/docker-machine
 
which docker-machine

Install the docker-machine bash completion scripts

https://github.com/docker/machine/tree/master/contrib/completion/bash

git clone git@github.com:docker/machine.git
sudo cp machine/contrib/completion/bash/* /etc/bash_completion.d
 
 
https://docs.docker.com/machine/get-started/ 
(Virtualbox should already be installed) 
docker-machine create --driver virtualbox default
docker-machine ls
docker-machine env default 
eval "$(docker-machine env default)" 
docker run busybox echo hello world  
docker-machine ip default 
docker run -d -p 8000:80 nginx
curl $(docker-machine ip default):8000 
 
https://docs.docker.com/machine/migrate-to-machine/ 
 
boot2docker docker-machine docker-machine description
init create Creates a new docker host.
up start Starts a stopped machine.
ssh ssh Runs a command or interactive ssh session on the machine.
save - Not applicable.
down stop Stops a running machine.
poweroff stop Stops a running machine.
reset restart Restarts a running machine.
config inspect Prints machine configuration details.
status ls Lists all machines and their status.
info inspect Displays a machine’s details.
ip ip Displays the machine’s ip address.
shellinit env Displays shell commands needed to configure your shell to interact with a machine
delete rm Removes a machine.
download - Not applicable.