Docker installation on Linux

Let's now see how to install and play with Docker on Linux. Only the Linux installation is described here. (See the Docker documentation for installation on other systems.) The following describes the installation on an Ubuntu system. The procedure is very similar on other Linux distributions, and also detailed in the Docker documentation.

The first step is to add the Docker gpg key to the apt registry, as can be seen in the following example:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Then the Docker repository can be added, as can be seen in the following code:

sudo add-apt-repository 
"deb [arch=amd64] https://download.docker.com/linux/debian
$(lsb_release -cs)
stable"

Finally, update the apt registry and install Docker, as shown in the following example:

$ sudo apt-get update
$ sudo apt-get install docker-ce

Now the Docker daemon is running, ready to be used. Before using it, there is one last thing to configure. Since Docker uses privileged features of Linux, it requires administration rights to use it. In practice, this means that all Docker commands have to be executed as root or via sudo. Both solutions can be dangerous and are annoying to use. A simple way to use Docker without sudo is to add users allowed to use Docker in the Docker group. For example, user alice can use Docker without sudo after running the following command:

$ sudo usermod -aG sudo alicedocker 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.158.134