azurejenkins

Install Docker

To install and use Docker, you must manually install it setting up Docker’s repositories and installing it from them.

  • Update the apt package index and install packages to allow apt to use a repository over HTTPS:

      $ sudo apt-get update
      $ sudo apt-get install -y \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg-agent \
        software-properties-common
    
  • Add Docker’s official GPG key:

      $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
  • Use the following command to set up the stable repository:

      $ sudo add-apt-repository \
        "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
        $(lsb_release -cs) \
        stable"
    
  • Update the apt package index to include above repository:

      $ sudo apt-get update
    
  • Install the latest version of Docker CE and containerd:

      $ sudo apt-get install -y docker-ce docker-ce-cli containerd.io
    
  • At this point, Docker CE is installed and running. The docker group is created but no users are added to it, so you need to use sudo to run Docker commands. To add the bitnami user to the docker group, execute the following command:

      $ sudo usermod -aG docker bitnami
    
  • You need to log out and log back in your shell for re-evaluate your group membership. You can verify that you can run docker commands without sudo:

      $ docker run hello-world
    

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Check the following links for more information on this:

Last modification February 27, 2019