报错信息:

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.37/containers/prune: dial unix /var/run/docker.sock: connect: permission denied
SHELL > docker pull mooncar/mooncar:dev-x86_64-20180627_1727
Warning: failed to get default registry endpoint from daemon (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.37/info: dial unix /var/run/docker.sock: connect: permission denied). Using system default: https://index.docker.io/v1/
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.37/images/create?fromImage=mooncar%2Fmooncar&tag=dev-x86_64-20180627_1727: dial unix /var/run/docker.sock: connect: permission denied

正确的是将当前用户加入docker组:

sudo gpasswd -a ${USER} docker

然后退出当前用户比如切换为root,再次切换为jing。然后执行docker-compose up -d就ok了。

jing@ubuntu:/tmp/docker$ sudo su
root@ubuntu:/tmp/docker$ su jing
jing@ubuntu:/tmp/docker$ sudo apt-get install docker-compose
jing@ubuntu:/tmp/docker$ docker-compose up -d
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐