这是我的docker-compose.yml:
version: '3.4'
services:
nginx:
restart: always
image: nginx:latest
ports:
- 80:80
volumes:
- ./misc/nginx.conf:/etc/nginx/conf.d/default.conf
- /static:/static
depends_on:
- web
web:
restart: always
image: celery-with-docker-compose:latest
build: .
command: bash -c "python /code/manage.py collectstatic --noinput && python /code/manage.py migrate && /code/run_gunicorn.sh"
volumes:
- /static:/data/web/static
- /media:/data/web/media
- .:/code
env_file:
- ./.env
depends_on:
- db
volumes:
- ./app:/deploy/app
worker:
image: celery-with-docker-compose:latest
restart: always
build:
context: .
command: bash -c "pip install -r /code/requirements.txt && /code/run_celery.sh"
volumes:
- .:/code
env_file:
- ./.env
depends_on:
- redis
- web
db:
restart: always
image: postgres
env_file:
- ./.env
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
redis:
restart: always
image: redis:latest
privileged: true
command: bash -c "sysctl vm.overcommit_memory=1 && redis-server"
ports:
- "6379:6379"
volumes:
pgdata:
当我运行
docker stack deploy -c docker-compose.yml cryptex
时,我得到了Non-string key at top level: true
docker-compose -f docker-compose.yml config
给了我ERROR: In file './docker-compose.yml', the service name True must be a quoted string, i.e. 'True'.
我正在使用最新版本的docker和compose。另外,我还是撰写v3的新手,并开始使用它来获取docker stack命令的可用性。如果您在配置文件中看到任何错误或多余内容,请告诉我。谢谢
最佳答案
您必须验证您的docker撰写文件,可能是其中的值较低
Validating your file now is as simple as docker-compose -f docker-compose.yml config. As always, you can omit the -f docker-compose.yml part when running this in the same folder as the file itself or having the
关于docker - 无法在Docker Compose v3中用 celery 启动django,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47907560/