Below are the installations steps/setup for Ubuntu, Fedora and Windows.
1. For Ubuntu
If this does not work, see bottom for an alternative method
First check your Ubuntu version
lsb_release -cs
This is a two stage process where you must first setup Docker repository and then install Docker from it.
First
sudo apt update
sudo apt install ca-certificates curl
Then add Docker's official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
Finally, setup appropriate Docker respository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
This step is usually not needed but following commands may come in handy
docker-machine start
docker-machine stop
docker-machine ip
docker-machine ssh
docker-machine scp
docker-machine upgrade
docker-machine restart
sudo docker run hello-world
If docker version does not work but docker --version works then do the following in its sequence
sudo services docker stop
sudo services docker start
sudo services start docker
sudo apt-get purge docker-ce
sudo rm -rf /var/lib/docker
Source https://docs.docker.com/install/linux/docker-ce/ubuntu/
This is a two stage process where you must first setup Docker repository and then install Docker from it.
First
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager \
--add-repo \
https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install docker-ce
If asked to accept GPG key, verify that it matches 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
Additional step for Fedora 31
sudo vi sudo gedit /etc/default/grub
Then append this systemd.unified_cgroup_hierarchy=0 to GRUB_CMDLINE_LINUX.
Follow this with
sudo grub2-mkconfig
and reboot.
Docker is installed but not started. That is, docker group is created but no users are added to the group.
sudo systemctl start docker
sudo docker run hello-world
If docker version does not work but docker --version works then do the following in its sequence
sudo services docker stop
sudo services docker start
sudo services start docker
sudo dnf remove docker-ce
sudo rm -rf /var/lib/docker
Source https://docs.docker.com/install/linux/docker-ce/fedora/
This is a two stage process where you must first setup Docker repository and then install Docker from it.
If docker is alread installed remove it with the following commands
sudo dnf remove docker-*
sudo dnf config-manager --disable docker-*
sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0
sudo firewall-cmd --permanent --zone=FedoraWorkstation --add-masquerade
sudo dnf install moby-engine docker-compose"
sudo systemctl enable docker
NOTE: You might need to reboot the system sudo systemctl reboot.
First download the stable .exe file
https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe
from https://store.docker.com/editions/community/docker-ce-desktop-windows
Double-click Docker for Windows Installer.exe
Double-click Docker for Windows. This should initiate a whale in the status bar.
Open PowerShell (my preferance)
docker version
docker run hello-world
Source https://docs.docker.com/docker-for-windows/install/
This is a method alternative to the official (above) one.
Check your Ubuntu version
lsb_release -cs
This is a two stage process where you must first setup Docker repository and then install Docker from it.
First
sudo apt-get update
sudo apt-key adv --keyserver \
hkp://p80.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository \
`deb https://apt.dockerproject.org/repo ubuntu-xenial main`
Then install
sudo apt-get update
apt-cache policy docker-engine
sudo apt-get install -y docker-engine
sudo systemctl status docker
sudo apt-get remove docker docker-engine
sudo apt-get purge docker-ce
sudo rm -rf /var/lib/docker
Source https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
First, add the user to the docker group
sudo groupadd docker
sudo usermod -aG docker <user-name>
Then, enter this group
newgrp docker
Now without sudo the <user-name> should be able to run docker run hello-world. Note that on reboot you should not need to type in the commands to enter docker group.