- Cannot connect to the Docker dae
- Cannot connect to the Docker dae
- Cannot connect to the Docker dae
- Cannot connect to the Docker dae
- Cannot connect to the Docker dae
- Cannot connect to the Docker dae
- Cannot connect to the Docker dae
- Cannot connect to the Docker dae
- Cannot connect to the Docker dae
- Cannot connect to the Docker dae
docker
本地默认是unix socket
,这里报错是使用了tcp
,默认情况下,Unix的socket属于用户root
,其它用户要使用要通过sudo
命令。由于这个原因,docker daemon
通常使用root
用户运行,使用了几种解决方式。
一丶未成功的(万一你们成了呢 #滑稽):
- 编辑
/etc/docker/daemon.json
无效
{
"registry-mirrors": ["https://kf0vxqi6.mirror.aliyuncs.com"],
"hosts": [
"tcp://0.0.0.0:2376",
"unix:///var/run/docker.sock"
]
}
- 添加用户组 无效
$ sudo groupadd docker
groupadd: group 'docker' already exists
$ sudo gpasswd -a <你的用户名> docker
$ sudo service docker restart
-
systemctl restart docker
无效
二丶成功的:
- 使用
sudo + 命令
(每次多写sudo,还要输密码,密码错了还要重来 :P )
sudo docker ps
-
unset DOCKER_HOST
(一次性的,不设置DOCKER_HOST) -
修改
~/.bashrc
文件
vi ~/.bashrc
# 在最下面添加一行:
export DOCKER_HOST='unix:///var/run/docker.sock'
source .bashrc
网友评论