For ones, who want to build and run Docker containers on Ubuntu-18.04 – first of all it is required to install Docker itself.
To install the latest version of Docker and to be able to upgrade it easily in future – it is recommended to install Docker from the official repository.
In this guide i will show how to install free Docker CE (Community Edition) on Ubuntu-18.04 from the stable official repository, how to verify that it is installed correctly and will show the common post-installation steps to perform.
Requirements: To install Docker on Ubuntu-18.04 – you must have 64-bit architecture and Linux kernel version 3.10 or higher. You can check if your system matches the requirements with the
uname -r commands.
Install Docker on Ubuntu-18.04
Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Verify that the key fingerprint is
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88:
$ sudo apt-key fingerprint 0EBFCD88 2>/dev/null | grep 9DC8
Set up the stable Docker’s repository:
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get update $ sudo apt-get install docker-ce
$ sudo systemctl start docker
Verify that Docker is installed correctly by running the
$ sudo docker run hello-world
Cool Tip: Docker successfully installed! It’s time to run first container! Read More →
First of all it is required to configure Docker daemon to start automatically at system boot.
Run the following command to add Docker to autostart:
$ sudo systemctl enable docker
And secondly, add your user to the
docker group to get rid of the need of typing
sudo each time you run the
$ sudo usermod -aG docker $USER
Info: Log out and log back to complete the group assignment.
To verify that you can run
$ docker run hello-world