Installing Docker on Ubuntu
In this article I show to to get docker set up on your environment. Due to the fact Docker’s containers must be created on Linux, all the commands here will be run on Ubuntu 14.04 64-bit.
(There have been reports of people getting Docker to run on 32-bit systems, but it is not currently supported).
To install Docker on Ubuntu, run the following commands:
$ 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 $ source /etc/bash_completion.d/docker.io
The Docker server is integrated into the same binary that you use as the client. Running the Docker daemon manually, on a Linux system is a simple as typing something like this:
$ sudo docker -d -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375
This command tells Docker to start in daemon mode (-d), create and listen to a Unix domain socket (-H unix:///var/run/docker.sock), and bind to all system IP addresses using the default unencrypted traffic port for docker (-H tcp://0.0.0.0:2375).
To enable the docker server to start when the system boots, type:
$ sudo update-rc.d docker.io defaults
To start the service immediately, you can use:
$ service docker.io start
Now we can test Docker by running:
$ docker run –rm -ti ubuntu:latest /bin/bash
If you get the error “dial unix /var/run/docker.sock: permission denied”, all you need to do is add your user to the docker user group. To do so run on your shell
“$ sudo usermod -a -G docker <username>”. Then, log out and in again (or even restart if needed)
That’s it. You should have Docker installed and running on your machine. Also, check how to setup a LEMP Environment with Docker and Vagrant on Ubuntu.