Docker on Ubuntu

As I said before, I’ve selected Docker for using containers.

For OS, I’ve selected Ubuntu Server 17.10 and for using containers the engine should be installed and then one proceeds.

System preparation & Docker installation

First thing first, the system should be prepared for engine installation and this preparation includes the OS update & prerequisite installation; and for sure hostname and IP configuration has been done before all.

  1. Update apt package index

sudo apt-get update

  1. Install prerequisites

sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y

  1. Add Docker official PGP key

curl -fsSL | sudo apt-key add –

  1. Validate newly installed PGP key

sudo apt-key fingerprint 0EBFCD88

  1. Add the Docker repository to the repository list on the server

sudo add-apt-repository “deb [arch=amd64] $(lsb_release -cs) stable”

  1. Again, update apt package index to apply recent changes to the repository

sudo apt-get update

  1. Install Docker

sudo apt-get install docker-ce

  1. If it’s not production environment we can go to “Running the first container” section otherwise if the server is working (or would work) in the production environment, it’s recommended to select the version of Docker-CE which is stable; for this propose below command would list all possible versions.

apt-cache madison docker-ce

  1. After finding the suitable version for production environments based on the server

sudo apt-get install docker-ce=<VERSION>


Running the first container

For testing if everything works fine, we can use a simple image and deploy it in order to test connectivity as well as container deployment; to do so it’s possible to deploy a small container from Docker registry by running below command.

sudo docker run hello-world

Running above command would get and deploy a small container which going to show output directly into the console used for lunch command.

In the next post, I’d describe different docker commands and how to use them.

Reference: Get Docker CE for Ubuntu

1 Comment

Add a Comment

It's your kindness to leave a reply/feedback