Ubuntu docker compose doesn't work - Shuang0420/Shuang0420.github.io GitHub Wiki
Ubuntu 下 docker 运行要 sudo,然而 docker-compose 不用,所以运行 docker-compose 时会报错
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
问题解决方案是统一 docker 和 docker-compose 的权限,一个方法是不用 sudo 开启 docker,步骤如下:
- Add the docker group if it doesn't already exist:
sudo groupadd docker - Add the connected user "$USER" to the docker group. Change the user name to match your preferred user if you do not want to use your current user:
sudo gpasswd -a $USER docker - Either do a
newgrp dockeror log out/in to activate the changes to groups.
再试一下运行 docker info,发现问题就解决啦~