How to Install?
This process will help you to guide you to install docker on a Ubuntu machine.
Install Docker from Ubuntu Repository
You can use apt-get command to install the Docker from Ubuntu base repository.
$ sudo apt install docker.io
Start the docker service and enable it to start automatically on system startup.
$ sudo systemctl start docker
$ sudo systemctl enable docker
Now, verify the docker version.
$ docker --version
$ Docker version 17.12.1-ce, build 7390fc6
Install Docker from Official Docker Repository
Prerequisites
Uninstall the older versions of Docker package, named docker or docker-engine or docker.io along with associated dependencies.
If the system does not have Docker packages, skip the below step.
sudo apt -y remove docker docker-engine docker.io
Contents such as images, volumes, and networks under /var/lib/docker/ are preserved.
Setup
Setup docker, open terminal and execute:
sudo apt update
Install the below packages to ensure the apt
work with https method, and CA certificates are installed.
sudo apt install -y apt-transport-https software-properties-common ca-certificates curl wget
Add the GPG key for Docker repository on your system.
wget https://download.docker.com/linux/ubuntu/gpg
sudo apt-key add gpg
Now, add the official Docker repository by running the below command in the terminal.
echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" | sudo tee /etc/apt/sources.list.d/docker.list
Update the apt database.
sudo apt update
Make sure you are installing the docker package from the official repository.
sudo apt-cache policy docker-ce
Output:
docker-ce:
Installed: (none)
Candidate: 18.03.1~ce~3-0~ubuntu
Version table:
18.03.1~ce~3-0~ubuntu 500
500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
More info: https://docs.docker.com/v17.09/engine/installation/linux/docker-ce/ubuntu/#install-docker-ce-1
Mac OS
Open a terminal an execute the following command:
brew cask install docker
Then launch the Docker app. Click next. It will ask for privileged access. Confirm. A whale icon should appear in the top bar. Click it and wait for "Docker is running" to appear.
You should be able to rundocker
commands now.
docker ps
Last updated
Was this helpful?