Docker is an open-source project that automates the deployment of applications inside software containers. Quote of features from Docker web pages:
Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in:
Now let’s see how to setup docker on Ubuntu 14.
Follow below steps for docker setup on Ubuntu 14:
Make sure to update ubuntu with latest packages.
]$sudo apt-get update && sudo apt-get -y upgrade
Make sure aufs support is available
]$ sudo apt-get install linux-image-extra-`uname -r`
Add docker repository key to apt-key for package verification.
]$ sudo apt-key adv –keyserver hkp://pgp.mit.edu:80 –recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Add the docker repository to Apt sources.
]$ echo “deb https://apt.dockerproject.org/repo ubuntu-trusty main” | sudo tee /etc/apt/sources.list.d/docker.list
Update the repository with the new addition.
]$ sudo apt-get update
Finally, download and install docker
]$ sudo apt-get install docker-engine
Ubuntu’s default firewall (UFW: Uncomplicated Firewall) denies all forwarding traffic by default, which is needed by docker.
Enable forwarding with UFW:
]$ sudo vi /etc/default/ufw
Finally, reload the UFW
]$ sudo ufw reload
By default, docker daemon will be run by root privileges. To run docker from non-root users with using sudo command we have to add a user to docker group.
- Adding a user to the Docker group
]$ sudo usermod -aG docker $(whoami)
Logout and re-login to reflect above changes.
With above installation of docker engine is completed and now use below commands to play with docker.
To check available options with docker, execute below command
output will look like below.
Checking docker version:
]$ docker version
- The main key to start working with docker containers is using images. There are many freely available images shared on public repositories (docker image index) and using docker command line (CLI) any one can easily access these images and can be pulled into local system.
Search for a docker image.
]$ sudo docket search <image_name>
Downloading an image from above search result:
]$ sudo docker pull ubuntu
Above command will pull an image from public repository into your local.
Checking downloaded image using docker CLI:
]$ sudo docker images