I have a somewhat peculiar scenario. I tend to execute command docker-compose -f dev.yml up --build
to get the containers up and work. Here, dev.yml
is development version of docker-compose.yml
. Till this very morning every thing was working fine, and all of the sudden, I started getting error regarding failure to connect to docker-daemon.
Now, this problem only occurs when I have --build
included in the command. If I only execute docker-compose -f dev.yml up
it works fine. If I include --build
into the command and execute it using sudo
it works fine again.
Things verified:
/var/run/docker.sock
Details of dev.yml
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
Update: My colleague got stuck with same issue. I have my doubts on config for celerybeat, celeryworker. Can anyone please verify? Thanks.
For me the following command worked,
sudo chown $USER:$USER -R .
Check this conversation I had on github, Issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With