Tested OSs: Centos7, Centos9 and Ubuntu 20
Step-1 (Optional)
*Note: Ignore this step, if you are not in installing docker in the University of Tartu's private cloud
- Create the daemon file manually. This is because of some conflict in University's Openstack Environment.
sudo mkdir -p /etc/docker && cd /etc/docker
- Create and update docker daemon file
1 2 3 4 5 6 | sudo tee /etc/docker/daemon.json <<EOF { "default-address-pools": [{"base":"172.80.0.0/16","size":24}] } EOF |
Step-2
- Now run this command. It will add the official Docker repository, download the latest version of Docker, and install it:
curl -fsSL https://get.docker.com/ | sh
- After installation has completed, start the Docker daemon:
sudo systemctl start docker
- Verify that it’s running:
sudo systemctl status docker
- Enable docker
sudo systemctl enable docker
Step-3
To run docker commands with non-root privileges
- Create a docker group (If it's already created then ignore): sudo groupadd docker
- Add a user to docker group: sudo usermod -aG docker $USER
- Activate the changes: newgrp docker
- Check the installation by displaying docker version: docker --version
- That's all for now.