docker(14)今天的docker错误:docker: 无法连接到unix:///var/run/docker.sock上的Docker守护程序

在一台设备(macOS)上,我尝试启动Docker,这已经是一个星期以来的第一次。

$ 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 的鲸鱼先生。

我输入了相同的命令。

$ 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来表达以上内容:

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

如果当初选择退出就好了。

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

只是一次退出还不够。似乎还登录了两次。常有常有。

这之后的工作,是将西森秀稔的量子计算机论文从arXiv发布的PDF转成文本,并使用docker和wc.awk工具进行处理。

今天的Docker错误:访问资源被拒绝

#仅提供一种选择,请将以下内容以中文进行翻译:参考资料。

最近我升级了MacOS,结果无法访问我正在用Docker开发的浏览器页面,原来只是Docker停止了而已。
链接:https://qiita.com/riotam/items/f39053909fa6f9723b70

根据上述的例子,报告出现了以下错误。

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

尽管情况相似,但警告差异的原因尚未调查。

文档历史记录:
版本号0.01,20190621,初稿
版本号0.02,20190622,上午,补充后续操作
版本号0.03,20190622,中午,补充参考资料
版本号0.04,20190625,登录shell时使用了与docker启动不同的用户

非常感谢您的阅读直到最后。

喜欢,请关注。

Thank you very much for reading to the last sentence.

请点击?图标并关注我,享受快乐生活。

このエントリーをはてなブックマークに追加
广告
将在 10 秒后关闭
bannerAds