关闭服务:
systemctl stop docker.service
systemctl stop docker.socket
修改/usr/lib/systemd/system/docker.socket文件:
[Socket]
ListenStream=/var/run/dockershim.sock
重新加载配置:
systemctl daemon-reload
启动服务:
systemctl start docker.socket
systemctl start docker.service
修改环境变量,在/etc/profile
中添加:
export DOCKER_HOST="unix:///var/run/dockershim.sock"
如果不修改环境变量,执行docker命令时会报错无法连接上docker,因为socket路径不对:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
scan: Docker Scan (Docker Inc., v0.8.0)
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
此处评论已关闭