Hi, In this article we are going to setup Docket on Ubuntu 15.04 also we will show you the usage of Docker-managed release packages and its working mechanism. Docker is an open-source program that enables a Linux application and its dependencies to be packaged as a container such as configuration files, however, unlike a virtual machine, a container doesn't run a OS, it shares the OS of the host, which in this case will be Ubuntu 15.04. It makes it possible to get more apps running on the same old servers by providing an additional layer of abstraction and automation of operating system level virtualization on Linux.
1) Docker's Prerequisites
First of all your system should latest and updated with the list of available packages so before installing you must upgrade your kernel and install the additional packages from packet manager with following command with root or sudo privileged user.
# apt-get update
If you are using an old release of your ubuntu server then you upgrade it using the following command.
# apt-get -y upgrade
Docker is missing with some of its features on the kernels that are older than version 3.10. So, to install Docker on Ubuntu Operating system make sure that its 64-bit installation of Ubuntu and have its kernel verion later than 3.10.
You can check the kernel version of your installed Ubuntu kernel version with following command.
root@ubuntu-15:~# uname -r
2) Docker’s Installation Process
The Docker’s installation was available only for Ubuntu in the past days but now its available for many other distributions like CentOS and other Red Hat distributions. Once you had fulfilled the requirements by updating your system with latest updates and patches for installing Docker, then go with its installation process by installing the docker-io package using below command.
# apt-get -y install docker.io
3) Docker's Configuration
After the installation process completes, we will create and fix the paths by creating a soft link between 'docker.io' in '/usr/local/bin/' to docker that is in the same folder with the following command.
# ln -sf /usr/bin/docker.io /usr/local/bin/docker
Now to confirm the status of docker’s service, execute the following command to be sure that its service is up and running.
# service docker start
# service docker status
In order to enable the docker services at boot up, let’s configure Docker to auto start when the server boots with below command.
# update-rc.d docker defaults
To start the daemon of Docker we can use the below command to be executed on the terminal and make sure its daemon is not previously in running state, if so then stop its daemon first and then run the below command.
4) Using Docker on Ubuntu
Here we will explain you about its usage that how we can get the Docker works for us.
To get the list of all the available commands, run the 'docker' command in the terminal and you will get a list of its all available commands with its descriptions that can be used to perform required tasks.
5) Downloading a Docker Container
Let’s begin using Docker! We will download the Docker’s image by using its docker command with 'pull' options to Pull an image or a repository from the docker registry server.
Here is its command to use.
# docker pull ubuntu
6) Running a Docker Container
To setup a basic ubuntu container with a bash shell, we just run one command as shown below and the docker run will run a command in a new container, where as -i attaches stdin and stdout, -t allocates a tty, and we’re using the standard ubuntu container.
# docker run -i -t ubuntu /bin/bash
In the output we can see the standard Ubuntu container that can be used.
So, we are using a bash shell inside of an Ubuntu docker container. If you wish to disconnect, or detach, from the Docker container’s shell without exiting from it we have to use the combination of these keys "Ctrl-p + Ctrl-q" , then you will be back to your previous window.
There are many community containers already available, which can be found through a search. In the command below we are searching for the keyword fedora, let see its output below.
# docker search fedora
We hope you have had a pretty good tour through what Docker is and how it works, but still there are many challenges to setup Docker in the Organizations. After going through this detailed article you are now able to setup and use Docker containers for any of your operating system by checking its availability. So, Feel free to get back to us in case of any difficulty.