Docker Tutorial : How To Install and configure Docker

Before installing docker , if you want to learn the basics,  head over to this article – what is docker?

In this article we will explain how to get started with docker by installing and configuring it on a Ubuntu server. Docker supports almost all Unix and Linux distributions. Getting started with docker is very easy there is no complex configuration for docker.

How to install Docker

Docker package is available in native apt repository. The installation package available in the repository will not be the latest version. If you want to install the latest release of docker, you need to install it from the source. In this post we will explain both repository and source installation.

Installing from apt repository

Follow the instructions give below to install docker from the apt repository.

1. Update the server

2. Install

3. Verify the installation

Installing the latest docker release

To install the latest docker release just execute the following curl command.

Pull a base image

Now we have docker installed on the host. Lets try to pull the latest ubuntu base image  from docker hub using the following docker command.

READ  How to Setup AWS ECS Cluster as Build Slave for Jenkins

Verify the downloaded image using the following docker command. It will list all the downloaded and created  images in the local repository.

Creating a container:

Now we have  the latest ubuntu docker image in our host. Lets create an interactive container named “test” from the ubuntu image using the following command.

The above command will create an interactive container with bash shell. you can try installing some package in that container.

Note: You can also create a container without having an image in the local repository. When you execute “docker run” command, docker will look for the base image in the local repository and if it doesn’t find any, docker will automatically pull down the image from the docker hub.

Type “exit” to exit the container. When you exit , the container will stop. You can view all the stopped and running containers using the following command.

READ  What is Docker? How Does it Work?

By default docker client communicates with the docker daemon using the Unix socket docker.sock. If you want to accept connections from a remote docker client, you need to start the docker daemon on a specific port. Follow the instructions give below to start docker daemon on a specific port.

1. Stop the docker service using the following command.

2. Execute the following command to start the docker daemon on port 5000 for client connections from all ip address. If you to establish connection from a particular host, then you can mention that ip address instead of “”

Now you will be able to run docker commands from the host as well as from a remote docker client. To run the docker commands from a remote client, use the following syntax.

In this post we have learned to install docker on a Ubuntu workstation, we created a basic container from a docker Ubuntu image. Also we learned how to set up client connections for docker daemon. In next post we will cover more advanced features of Docker.

Free DevOps Resources

Get DevOps news, tutorials and resources in your inbox. A perfect way If you want to get started with devops. Like you, we dont like spam.