Help us understand the problem. What is going on with this article?

docker(14)今日のdocker error:docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

More than 1 year has passed since last update.

ある機材(macOS)で1週間ぶりにdockerを起動しようとした。

macOS
$ docker run -v /Users/administrator/Downloads/nakamori:/home/nakamori -it ubuntu /bin/bash
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'

しばらくdocker使っていなかった。

dockerが起動していない

画面の右上にdockerのくじらさんがいない。

アプリケーションのdockerのアイコンダブルクリック。

最新版をダウンロード始めた。

更新済んだ。

画面の右上にdockerのくじらさんがいる。

同じコマンドを叩いた。

macOS
$ docker run -v /Users/administrator/Downloads/nakamori:/home/nakamori -it ubuntu /bin/bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
5b7339215d1d: Pull complete 
14ca88e9f672: Pull complete 
a31c3b1caad4: Pull complete 
b054a26005b7: Pull complete 
Digest: sha256:9b1702dcfe32c873a770a32cfd306dd7fc1c4fd134adfb783db68defc8894b3c
Status: Downloaded newer image for ubuntu:latest
root@34ece5f89e7f:/# apt update; apt -y upgrade
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:3 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [553 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [4169 B]      
Get:6 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [719 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]  
Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [5436 B]
Get:9 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:11 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]                                                                                                                                             
Get:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]                                                                                                                                                   
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [856 kB]                                                                                                                                            
Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [7239 B]                                                                                                                                      
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [10.8 kB]                                                                                                                                     
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1222 kB]                                                                                                                                       
Get:17 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [2496 B]                                                                                                                                          
Get:18 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [3918 B]                                                                                                                                      
Fetched 16.8 MB in 7s (2271 kB/s)                                                                                                                                                                                              
Reading package lists... Done
Building dependency tree       
Reading state information... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  gcc-8-base libgcc1 libstdc++6 libsystemd0 libudev1
5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 717 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsystemd0 amd64 237-3ubuntu10.23 [204 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gcc-8-base amd64 8.3.0-6ubuntu1~18.04.1 [18.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libstdc++6 amd64 8.3.0-6ubuntu1~18.04.1 [400 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgcc1 amd64 1:8.3.0-6ubuntu1~18.04.1 [40.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libudev1 amd64 237-3ubuntu10.23 [53.6 kB]
Fetched 717 kB in 2s (290 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 4040 files and directories currently installed.)
Preparing to unpack .../libsystemd0_237-3ubuntu10.23_amd64.deb ...
Unpacking libsystemd0:amd64 (237-3ubuntu10.23) over (237-3ubuntu10.22) ...
Setting up libsystemd0:amd64 (237-3ubuntu10.23) ...
(Reading database ... 4040 files and directories currently installed.)
Preparing to unpack .../gcc-8-base_8.3.0-6ubuntu1~18.04.1_amd64.deb ...
Unpacking gcc-8-base:amd64 (8.3.0-6ubuntu1~18.04.1) over (8.3.0-6ubuntu1~18.04) ...
Setting up gcc-8-base:amd64 (8.3.0-6ubuntu1~18.04.1) ...
(Reading database ... 4040 files and directories currently installed.)
Preparing to unpack .../libstdc++6_8.3.0-6ubuntu1~18.04.1_amd64.deb ...
Unpacking libstdc++6:amd64 (8.3.0-6ubuntu1~18.04.1) over (8.3.0-6ubuntu1~18.04) ...
Setting up libstdc++6:amd64 (8.3.0-6ubuntu1~18.04.1) ...
(Reading database ... 4040 files and directories currently installed.)
Preparing to unpack .../libgcc1_1%3a8.3.0-6ubuntu1~18.04.1_amd64.deb ...
Unpacking libgcc1:amd64 (1:8.3.0-6ubuntu1~18.04.1) over (1:8.3.0-6ubuntu1~18.04) ...
Setting up libgcc1:amd64 (1:8.3.0-6ubuntu1~18.04.1) ...
(Reading database ... 4040 files and directories currently installed.)
Preparing to unpack .../libudev1_237-3ubuntu10.23_amd64.deb ...
Unpacking libudev1:amd64 (237-3ubuntu10.23) over (237-3ubuntu10.22) ...
Setting up libudev1:amd64 (237-3ubuntu10.23) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...

docker起動したのと違う利用者でshellにloginしてた

suコマンドなどで、docker起動した利用者と違うIDでshellにloginしていると同じエラーがでることを確認。

exitすればよかった。

macOS
bash-3.2$ docker images
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/images/json: dial unix /var/run/docker.sock: connect: permission denied
bash-3.2$ docker images
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/images/json: dial unix /var/run/docker.sock: connect: permission denied
bash-3.2$ exit
exit
bash-3.2$ docker images
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/images/json: dial unix /var/run/docker.sock: connect: permission denied
bash-3.2$ exit
exit
KM-S05:apj administrator$ docker images
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
kaizenjapan/qc-nakamori     latest              5186ef78791c        3 days ago          235MB
kaizenjapan/qc-nakamori     <none>              0b0b4bb6b179        3 days ago          194MB
ubuntu                      latest              4c108a37151f        6 days ago          64.2MB
kaizenjapan/100pon          latest              07d217d26151        5 months ago        20.4GB
continuumio/anaconda3       latest              69acfdf1121f        5 months ago        3.72GB
nginx                       latest              7042885a156a        5 months ago        109MB
kaizenjapan/gccv850src      latest              5e61526ac5aa        6 months ago        2.3GB
gcc                         latest              48a9ecda4099        6 months ago        1.15GB
kaizejpanan/gccv850src      latest              48a9ecda4099        6 months ago        1.15GB
centos                      latest              1e1148e4cc2c        6 months ago        202MB
kanetugu2015/athrill_asp3   ver3.0              ffa434b44c7b        7 months ago        1.43GB

一度exitしただけではだめだった。二重にsuしてたみたい。あるある。

この後の作業

量子計算機 arXiv掲載 西森 秀稔 論文単語帳 dockerでPDF to Text & wc.awk
https://qiita.com/kaizen_nagoya/items/319672853519990cee42

今日のdocker error:denied: requested access to the resource is denied
https://qiita.com/kaizen_nagoya/items/fae512ef5e0c04dabc25

参考資料

macOSをアップデートしたところDockerで開発していたブラウザページにアクセスできなくなったが、Dockerが止まっていただけだった件
https://qiita.com/riotam/items/f39053909fa6f9723b70

上記事例だと次のエラーが出たという。

macOS
ERROR: Couldn't connect to Docker daemon. You might need to start Docker for Mac.

似た状態なのに、警告の違いの理由は未調査

文書履歴

ver. 0.01 20190621 初稿
ver. 0.02 20190622 午前 この後の作業追記
ver. 0.03 20190622 昼 参考資料追記
ver. 0.04 20190625 docker起動したのと違う利用者でshellにloginしてた

このエントリーをはてなブックマークに追加
https://b.hatena.ne.jp/guide/bbutton

kaizen_nagoya
I'm a network designer.I work on TOPPERS SmallestSetProfile Kernel,MISRA-C, STARC RTL Design StyleGuide (Verilog-HDL),HAZOP,ISO/IEC15504(AutomotiveSPICE),ISO26262. I was an editor on ISO/IEC 15504.
https://researchmap.jp/blogs/blog_entries/view/81777/f691323917cc4ea12caf0b03b34c8ea0?frame_id=442673
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away