Install and Manage Docker on Ubuntu 15.10 & 14.04 LTS

Docker is container-based application framework, which wrap of a specific application with all its dependencies in a container. Docker containers can easily to ship to remote location on start there without making entire application setup. 

1. Verify Requirements

For standard installation Docker required 64 bit operating system having Kernel >= 3.10 version. Older versions of Kernel have some missing requirements to run all features of Docker.
$ uname -r

For Ubuntu 15.10 & 14.04 Docker recommended to install the linux-image-extra kernel package.
$ sudo apt-get install linux-image-extra-$(uname -r)

2. Add Docker Apt Repository

First import docker GPG key to verify packages signature before installing them with apt-get.
$ sudo apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Now create a new apt configuration file /etc/apt/sources.list.d/docker.list and one of below docker

For Ubuntu Wily 15.10

deb ubuntu-wily main

For Ubuntu Trusty 14.04 (LTS)

deb ubuntu-trusty main

3. Install Docker

First make sure there are no old repositories added in your system. Purge them before installing them.
$ sudo apt-get purge lxc-docker
Now use the following commands to upgrade apt index and install docker engine on your system.
$ sudo apt-get update
$ sudo apt-get install docker-engine
After successful installation of Docker engine, Let’s start the docker service.
$ sudo service docker start

4. Manage Docker Container

Search Docker Images

First of all search Docker container images from Docker hub. For example, below command will search all images with Ubuntu and list as output
# docker search ubuntu

Download Docker Images

Now download the Docker container with name Ubuntu on your local system using following commands.
# docker pull ubuntu

latest: Pulling from library/ubuntu

fa5be2806d4c: Pull complete 
b4af4261cb15: Downloading [==>               ] 3.779 MB/70.55 MB
5d358abc5d9c: Download complete 
2933d50b9f77: Download complete 
Now make sure that above images has been downloaded successfully on your system. Below command list all images.
# docker images

REPOSITORY  TAG            IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu      latest         36248ae4a9ac        7 days ago          188MB

Launch New Container with Image

Finally launch a Docker container using above downloaded image on your system. Below command will start a new container and provide you access of that container with /bin/bash shell.
# docker run -i -t ubuntu /bin/bash
To exit from docker container type CTRL + P + Q. This will leave container running in background an provide you host system console. If you used exit command, it will stop the current container.
After existing from Docker container, execute below command to list all running containers.
# docker ps

f2582758af13   ubuntu  "/bin/bash"    2 hours ago    Up 2 hours             first_ubuntu
By default Above command will list only running containers. To list all containers (including stopped container) use following command.
# docker ps -a

Start/Stop/Attach Container

You can start, stop or attach to any containers with following commands. To start container use following command.
# docker start <CONTAINER ID>
To stop container use following command.
# docker stop <CONTAINER ID>
To attach to currently running container use following command.
# docker attach <CONTAINER ID>

About Author:

I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Newer Post
Older Post


Post a Comment