How to Install Docker on Ubuntu/Mint
To get started with Docker Engine on Ubuntu, Please follow the below guide :
To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:
- Ubuntu Focal 20.04 (LTS)
- Ubuntu Bionic 18.04 (LTS)
- Ubuntu Xenial 16.04 (LTS)
Docker Engine is supported on x86_64
(or amd64
), armhf
, and arm64
architectures.
Uninstall old versions
Older versions of Docker were called docker
, docker.io
, or docker-engine
. If these are installed, uninstall them:
$ sudo apt-get remove docker docker-engine docker.io containerd runc
Installation methods
You can install Docker Engine in different ways, depending on your needs:
1. From The Repository
2. From the Source code
3. With the Convinience script.
Install using the repository
Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.
SET UP THE REPOSITORY
Update the
apt
package index and install packages to allowapt
to use a repository over HTTPS:$ sudo apt-get update $ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common
Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Verify that you now have the key with the fingerprint:
# apt-key fingerprint 0EBFCD88
3. Use the following command to set up the stable repository. To add the nightly or test repository, add the word
nightly
or test
(or both) after the word stable
in the commands below. for mint 20 use : - focal
# add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
focal \
stable"
INSTALL DOCKER ENGINE
Update the
apt
package index, and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:# apt-get update # apt-get install docker-ce docker-ce-cli containerd.io
2. To install a specific version of Docker Engine, list the available versions in the repo, then select and install:
a. List the versions available in your repo:
$ apt-cache madison docker-ce
docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 5:18.09.0~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 18.06.1~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 18.06.0~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
...
b. Install a specific version using the version string from the second column, for example, 5:18.09.1~3-0~ubuntu-xenial
.
$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
3. Start Docker Service.
# systemctl start docker
4. Verify that Docker Engine is installed correctly by running the hello-world
image.
# docker run hello-world
Install from a package
If you cannot use Docker’s repository to install Docker Engine, you can download the .deb
file for your release and install it manually. You need to download a new file each time you want to upgrade Docker.
Go to
https://download.docker.com/linux/ubuntu/dists/
, choose your Ubuntu version, then browse topool/stable/
, chooseamd64
,armhf
, orarm64
, and download the.deb
file for the Docker Engine version you want to install.Install Docker Engine, changing the path below to the path where you downloaded the Docker package.
$ sudo dpkg -i /path/to/package.deb
The Docker daemon starts automatically.
Verify that Docker Engine is installed correctly by running the
hello-world
image.$ sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
Install using the convenience script
Docker provides convenience scripts at get.docker.com and test.docker.com for installing edge and testing versions of Docker Engine - Community into development environments quickly and non-interactively. The source code for the scripts is in the docker-install
repository.
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
How to Install Docker on Windows 10
No comments