DEV Community

Cover image for How to install Docker on Ubuntu 18.04
Jayden Nguyen
Jayden Nguyen

Posted on

How to install Docker on Ubuntu 18.04

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. You can references to documents at this https://www.docker.com/ .

Step 1: Need to update software repositories. Run the following command:

sudo apt-get update

Step 2: Install Docker on Ubuntu 18.04

To install latest version you can run command

sudo apt install docker-ce docker-ce-cli containerd.io

To install specific version docker

apt list -a docker-ce

Then install specific version

sudo apt install docker-ce= docker-ce-cli= containerd.io

You can verify Docker service after install. It is start automation when install completed

sudo systemctl status docker

Step 3: Execute docker on-non root user

sudo usermod -aG docker $USER

Finally, you can make verify docker is install success

docker run hello-world

Uninstall docker

To stop all running containers and Docker instance

docker container stop $(docker container ls -aq)

docker system prune -a --volumes

Now uninstall Docker as any other package installed with apt

sudo apt purge docker-ce

sudo apt autoremove

Conclusion

In this post I will introduction way to install docker on Ubuntu 18.04. To learn more about Docker you, check out official Docker Offical Document

If you have any question please comment or contact me.

Author: @NHB Khanh

Facebook: facebook.com/khanhnhb

Email: khanhnhbse@gmail.com

Top comments (0)