documentation/Examples/Debian/Install Docker.md

1.9 KiB

Procedure
  1. Run apt udpate

  2. Install the following:

     apt install ca-certificates curl
    
  3. Create the keyrings directory with correct permissions:

     install -m 0755 -d /etc/apt/keyrings
    
  4. Save the current key from Docker:

     curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
    
  5. Allow everybody to read the docker.asc key:

    chmod a+r /etc/apt/keyrings/docker.asc
    
  6. Add the official Docker repository to apt:

     echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
    
  7. Run apt update again

  8. Install the required Docker packages:

     apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    
  9. Test that Docker is installed via docker --version

  10. Test the Docker hello-world image:

    docker run hello-world
    
Administration
  1. Create a volume for Portainer:

     docker volume create portainer_data
    
  2. Install Portainer:

     docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.20.3
    

    Note: The version number 2.20.3 is current at the time of writing but may change in the future

  3. Connect to Portainer's web interface by visiting port 9443 in the address bar, e.g. https://debian-host:9443/

Extras
  1. If installing a Microsoft SQL Server for Linux container running Ubuntu, create a volume that maps to /var/opt/mssql/data in the container. The databases you create will persist across recreating or duplicating/editing. No additional configuration is needed.
Sources

https://docs.docker.com/engine/install/debian/