Posted by : Ldonjibon Tuesday, January 6

This will ensure Docker is installed, configured, and ready to use without .


1. Update Your System

First, update your package list and upgrade existing packages:

sudo apt update && sudo apt upgrade -y

2. Install Required Dependencies

Install the necessary packages to allow apt to use repositories over HTTPS:

sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

3. Add Docker’s Official GPG Key

Add Docker’s GPG key to ensure the packages you download are authentic:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

4. Add the Docker Repository

Add the :

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

5. Install

Update your package list again and install Docker:

sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io

6. Verify Docker Installation

Check if Docker is running:

sudo systemctl status docker
  • If it’s not running, start it:
  • sudo systemctl start docker

7. Enable Docker to Start on Boot

sudo systemctl enable docker

8. Add Your User to the Docker Group

To run Docker commands without sudo, add your user to the docker group:

sudo usermod -aG docker $USER
  • Log out and log back in for this change to take effect.

9. Verify Docker Works Without sudo

Run the following command to verify Docker works without sudo:

docker --version docker run hello-world
  • If you see the hello-world message, Docker is working correctly.

10. (Optional) Install

If you need Docker Compose, install it with:

sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
  • Verify the installation:
  • docker-compose --version

Troubleshooting Tips

  • If you encounter permission issues, ensure your user is in the docker group and that you’ve logged out and back in.
  • If Docker fails to start, check the logs:
journalctl -u docker --no-pager -n 50

Leave a Reply

Feel Free to pour out your mind to make us improve

Subscribe to Posts | Subscribe to Comments

- Copyright © InformationSpot | information spot for tutorials - Blogger Templates - Powered by Blogger - Designed by Johanes Djogan -