docker-component初次使用坑
$ docker info
Client:
Debug Mode: false
Server:
ERROR: 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.40/info: dial unix /var/run/docker.sock: connect: permission denied
errors pretty printing info
明显是没有权限,一个是用sudo来执行,一个是把用户加入docker组然后重启docker
因为在docker守护进程启动的时候,会默认给docker的用户组权限。
$ docker-compose ps
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
刚开始没有头绪,在issue https://github.com/docker/compose/issues/4181 中找答案,前面的都试过了,直到看到
......
So I tried to use Docker to build each file individually:
docker build -f="Dockerfile-drupal" .
This gave me a more useful error:
Error checking context: 'no permission to read from some/data/directory'
......
啊,还是权限问题,只是docker那边懒得设置group一直用sudo
$ sudo usermod -aG docker ${USER}