Updated on 2023-05-26 GMT+08:00

No Deployment Permissions

Symptoms

Case 1: The error message connect: permission denied is displayed.

Case 2: An error message is displayed, indicating that the user does not have permissions to access /etc/docker/daemon.json:.

Cause Analysis

Only the root user and users in the Docker user group are allowed to perform operations on Docker.

Solution

  1. Add the user to the Docker user group.

    1. Log in to the server using a user account with the sudo permissions, for example, testuser.
    2. Check whether the Docker user group exists.
      sudo cat /etc/group | grep docker
      1. If so, add the user to the Docker user group.
        sudo usermod -aG docker testuser
      2. If not, create a Docker user group and add the user to the group.
        sudo groupadd docker
        sudo usermod -aG docker testuser

  2. Exit the server. Then, log in to the server again and check whether the user can run the Docker command.

    docker  info

  3. If another error message, indicating that the user does not have permissions to access /var/run/docker.sock, is displayed, modify the permissions for /var/run/docker.sock.

    sudo chmod a+rw /var/run/docker.sock

Running Docker Commands FAQs

more