Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set up Docker

Shulou Source: shulou.com Published: 2022-06-03 06:21:52 10月19日 Update

This article mainly explains "how to set Docker". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn "How to set Docker"!

In Ubuntu, after installing Docker, when we execute docker-related commands, we will encounter the following prompt:

$ docker psGot permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json: dial unix /var/run/docker.sock: connect: permission denied

This is because Docker processes use Unix sockets instead of TCP ports. By default, Unix sockets belong to the root user, so root access is required. Details are as follows:

Manage Docker as a non-root userThe docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can only access it using sudo. The docker daemon always runs as the root user.If you don't want to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.

Solution:

Add users to docker group,

sudo groupadd dockersudo gpasswd -a ${USER} dockersudo newgrp docker At this point, I believe everyone has a deeper understanding of "how to set Docker", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Tags: Content user learning practical deeper information interest method command practicality reality situation simple operation method more friends permissions port website details Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Information Shulou Technology Apple Docker