Docker : Dockerデーモンソケットに接続しようとしている間、許可されない許可


これは大部分は私自身のためのメモであるので、私は確かに私も将来これにつまずくでしょう.
Dockerコマンドを実行しようとすると、以下のようなエラーが発生します.
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create?name=prom_empty: dial unix /var/run/docker.sock: connect: permission denied
それはおそらくあなたのユーザがDockerグループにいないからです.
これを修正するには、単にグループを作成し、それを追加します.
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
$ newgrp docker
あなたがsnapを使っているDockerをインストールするならば、例えば:
$ sudo snap install docker
次に、追加の手順が必要です.
$ sudo snap disable docker
$ sudo snap enable docker
再びLOG Worldイメージを実行してDockerのインストールをテストします.
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:7f0a9f93b4aa3022c3a4c147a449bf11e0941a1fd0bf4a8e6c9408b2600777c5
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
詳細と便利なポストリソースをインストールします.
ああ、それでした.