我有点奇怪的情况.我倾向于执行命令docker-compose -f dev.yml up –build来使容器运行起来.这里,dev.yml是docker-compose.yml的开发版本.直到今天早上,每件事情都工作正常,突然间,我开始收到有关无法连接到docker-daemon的错误.
现在,只有在命令中包含–build时才会出现此问题.如果我只执行docker-compose -f dev.yml,它可以正常工作.如果我将–build包含在命令中并使用sudo执行它,它再次正常工作.
事情已验证:
>执行命令的用户被添加到具有的docker组
/var/run/docker.sock的权限
dev.yml的详细信息
@H_502_14@version: '2'
volumes:
postgres_data_dev: {}
postgres_backup_dev: {}
services:
postgres:
build: ./compose/postgres
volumes:
- postgres_data_dev:/var/lib/postgresql/data
- postgres_backup_dev:/backups
environment:
- POSTGRES_USER=rocky
django:
build:
context: .
dockerfile: ./compose/django/development/Dockerfile
depends_on:
- postgres
environment:
- POSTGRES_USER=rocky
- USE_DOCKER=yes
volumes:
- .:/app
- /tmp/
links:
- postgres
- redis
expose:
- "8000"
env_file:
- ./dev.env
Nginx:
build:
context: .
dockerfile: ./compose/Nginx/development/Dockerfile
depends_on:
- django
ports:
- "0.0.0.0:80:80"
links:
- django
volumes_from:
- django
redis:
image: redis:latest
hostname: redis
celeryworker:
build:
context: .
dockerfile: ./compose/django/development/Dockerfile
env_file: ./dev.env
depends_on:
- django
- redis
- postgres
volumes_from:
- django
command: celery -A rocky.taskapp worker -l INFO
restart: on-failure
celerybeat:
build:
context: .
dockerfile: ./compose/django/development/Dockerfile
env_file: ./dev.env
depends_on:
- django
- redis
- postgres
- celeryworker
volumes_from:
- django
command: celery -A rocky.taskapp beat -l INFO
更新:
我的同事遇到了同样的问题.我对celerybeat,celeryworker的配置有疑问.有人可以验证吗?谢谢.
最佳答案
原文链接:https://www.f2er.com/docker/437137.html