解决 ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiojing825/article/details/79494408

ubuntu16.04 安装完docker后在docker-compose.yml文件所在目录执行:

jing@ubuntu:/tmp/docker$ docker-compose up -d

报错:

ERROR: Couldn’t connect to Docker daemon at http+docker://localunixsocket - is it running?

If it’s at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

网上各种路七八糟的解决方式,真是吐槽。

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

jing@ubuntu:/tmp/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$ docker-compose up -d

猜你喜欢

转载自blog.csdn.net/xiojing825/article/details/79494408