Docker Install and Configuration

  • ¬†Assumptions
    • You have an Ubuntu 22.04 Linux server created
      • 4GB of RAM
      • 30GB of Drive Storage
  • Install Docker
    • sudo apt-get update
    • sudo apt-get install ca-certificates curl gnupg
    • sudo install -m 0755 -d /etc/apt/keyrings
    • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
      
    • sudo chmod a+r /etc/apt/keyrings/docker.gpg
    • echo \
        "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
        $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
        sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
      
    • sudo apt-get update
    • sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  • Add Current User to Docker Group
    • By default, only the root user can do docker commands, you need to add your current user to the docker group in order to allow it to run docker commands.
      • sudo groupadd docker
      • sudo gpasswd -a $USER docker
      • newgrp docker
  • Test Docker installation
    • docker run hello-world
      • This command runs a test docker container to see if your installation functions normally. The output should look like the image below

Leave a Reply

Your email address will not be published. Required fields are marked *