Sunday, October 20, 2024

Install Docker on Ubuntu 22.04

Steps to Install Docker on Ubuntu 22.04

  1. Update the package list:
    sudo apt update
  2. Install necessary packages:
    sudo apt install apt-transport-https ca-certificates curl software-properties-common
  3. Add Docker’s official GPG key:
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. Set up the stable Docker repository:
    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. Update the package list again:
    sudo apt update
  6. Install Docker:
    sudo apt install docker-ce docker-ce-cli containerd.io
  7. Verify Docker installation:
    sudo docker --version
  8. Add your user to the docker group:
    sudo usermod -aG docker $USER
  9. Activate the changes to the user group:
    newgrp docker
  10. Verify Docker without sudo:
    docker run hello-world

No comments:

Post a Comment