Skip to content

Instantly share code, notes, and snippets.

@bigsnarfdude
Created March 22, 2025 03:45
Show Gist options
  • Save bigsnarfdude/b2549e4342b22032f619939419bd9def to your computer and use it in GitHub Desktop.
Save bigsnarfdude/b2549e4342b22032f619939419bd9def to your computer and use it in GitHub Desktop.
installdocker ubuntu

Installing Docker on Ubuntu can be done in a few ways, but the most common and recommended method is through Docker's official apt repository. Here's a breakdown of the process, combining key information from the search results:

Installation Using the Apt Repository:

This method ensures you get the latest stable version and simplifies future updates. Here's a step-by-step guide:

  • 1. Update the package index and install necessary packages:
    • sudo apt-get update
    • sudo apt-get install ca-certificates curl gnupg
  • 2. 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
  • 3. Set up the Docker repository:
    • echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  • 4. Update the package index again:
    • sudo apt-get update
  • 5. Install Docker Engine:
    • sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  • 6. Verify the installation:
    • sudo docker run hello-world

Important Notes:

  • These instructions are for installing Docker Engine. There is also Docker Desktop for linux, which is an application that provides a GUI, and other tools.
  • It is important to keep your system updated.
  • It is also good practice to add your user to the docker group so that you do not have to use sudo every time you run a docker command.

I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment