# Docker install 1st

Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker `apt` repository. Afterward, you can install and update Docker from the repository.

1. Set up Docker's `apt` repository.
    
    ```bash
    # Add Docker's official GPG key:
    sudo apt update
    sudo apt install ca-certificates curl
    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
    
    # Add the repository to Apt sources:
    sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
    Types: deb
    URIs: https://download.docker.com/linux/ubuntu
    Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
    Components: stable
    Signed-By: /etc/apt/keyrings/docker.asc
    EOF
    
    sudo apt update
    ```
2. Install the Docker packages.
    
    <div aria-role="tabpanel" class="tabs" x-data="{ selected: 'Latest' }"><div aria-role="tablist" class="tablist"><button class="tab-item border-blue border-b-4 dark:border-b-blue-600">Latest</button> <button class="tab-item">Specific version</button></div><div><div :class="selected !== 'Latest' && 'hidden'" aria-role="tab" class="">  
    </div></div></div>To install the latest version, run:
    
    ```console
     sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    
    ```
    
    > <div class="admonition-header"><span class="admonition-icon"><svg fill="none" height="24" viewbox="0 0 24 24" width="24"><path d="M12 16V12m0-4H12.01M22 12c0 5.5228-4.4772 10-10 10C6.47715 22 2 17.5228 2 12 2 6.47715 6.47715 2 12 2c5.5228.0 10 4.47715 10 10z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg></span><span class="admonition-title">Note</span></div>The Docker service starts automatically after installation. To verify that Docker is running, use:
    > 
    > ```console
    >  sudo systemctl status docker
    > 
    > ```
    > 
    > Some systems may have this behavior disabled and will require a manual start:
    > 
    > ```console
    >  sudo systemctl start docker
    > 
    > ```
3. Verify that the installation is successful by running the `hello-world` image:
    
    <div class="group mt-2 mb-4 flex w-full scroll-mt-2 flex-col items-start gap-4 rounded bg-gray-50 p-2 outline outline-1 outline-offset-[-1px] outline-gray-200 dark:bg-gray-900 dark:outline-gray-800" data-pagefind-ignore="" x-data="" x-ref="root"><div class="relative w-full"><div class="syntax-light dark:syntax-dark not-prose w-full"><button class="top-1
    absolute right-2 z-10 text-gray-300 dark:text-gray-500" title="copy"><span class="icon-svg hidden group-hover:block"><svg height="48" viewbox="0 -960 960 960" width="48"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"></path></svg></span></button><div class="highlight"></div></div></div></div>```console
     sudo docker run hello-world
    ```