Installing docker

  1. Set up the repository

    Install packages to allow apt to use a repository over HTTPS:

                  $ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

    Add Docker’s official GPG key:

                  $ curl -fsSL | sudo apt-key add -

    Add the Docker repository to APT sources:

    $ sudo add-apt-repository  "deb [arch=amd64]  $(lsb_release -cs) stable"

    Next, update the package database with the Docker packages from the newly added repo:

                  $ sudo apt-get update

  2. Install Docker Community Edition(CE).

    Update the apt package index.

                $ sudo apt-get update

    Install the latest version of Docker CE

                $ sudo apt-get -y install docker-ce

    Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it's running:

                $ sudo systemctl status docker

  3. Verify that Docker CE is installed correctly by running the hello-world image.

                   $ sudo docker run hello-world

  4. Executing Docker without sudo

           If you want to avoid typing sudo whenever you run the docker command, add your user to the docker group:

                        $ sudo usermod -aG docker ${USER}

           To apply the new group membership, you can log out of the server and back in, or you can type the following:

                        $ su - ${USER}

           You will be prompted to enter your user's password to continue. Afterwards, you can confirm that your user is now added to the docker group by typing:

                       $ id -nG

Installing docker-compose

  1. Run this command to download the Docker Compose version 1.17:

                            $ sudo curl -L`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

  2. Apply executable permissions to the binary:

                            $ sudo chmod +x /usr/local/bin/docker-compose

  3. Test the installation.

                                    $ docker-compose --version

  • No labels