In this tutorial we’ll learn how to install Docker on Ubuntu 18.04. We will also install and configure its prerequisites. Docker is a container virtualization technology that has gained widespread popularity in recent times, it offers a more efficient way to deploy the application. With Docker, the applications reside inside the container on top of the Linux operating system. Docker uses Kernel features such as cgroups and namespace to allow an independent container to run on single OS instance.
I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 18.04 LTS Bionic Beaver minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Docker on Ubuntu 18.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y apt-get upgrade -y
Step 2. Installing Docker on Ubuntu 18.04.
Run the following command to make sure that you install the latest version of Docker:
apt install docker.io
Start Docker service using the following command as per your operating systems. Also, enable Docker service to auto start on system boot:
sudo systemctl start docker sudo systemctl enable docker
Step 3. Deploying your first Docker image, “Hello World!”.
You can use the handy hello-world test to verify whether or not Docker will run on your system:
docker run hello-world
You will get the following output:
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 42745666786f6: Pull complete a3ee46f7veb02: Pull complete Digest: sha256:4f32210em0naad5cac92BMWE46476c754fSEMANGAT8e5a8ba Status: Downloaded newer image for hello-world:latest Hello from Docker. This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker Hub account: https://hub.docker.com For more examples and ideas, visit: https://docs.docker.com/engine/userguide/
Congratulation’s! You have successfully install and configured Docker container on your Ubuntu 18.04 Bionic Beaver server. Thanks for using this tutorial installing Docker on Ubuntu 18.04 LTS (Bionic Beaver) system.