docker - 无法在Docker Compose v3中用 celery 启动django

标签 docker docker-compose

这是我的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/

相关文章:

ubuntu - 无法从任何地方甚至本地主机访问暴露端口上的 Docker 容器

docker - Jupyterhub:权限被拒绝(从零到 Jupyterhub)

windows - 在适用于 Windows 的 Ubuntu 应用程序上安装 Docker

docker - Docker Compose phpmyadmin登录失败

symfony - fedora中用于docker的setfacl权限以获取symfony缓存

Docker容器迁移

docker-compose 在主机重启后启动容器。哪个?

docker - Dockerfile 中未设置环境变量

node.js - nodejs 应用程序在 docker-compose up 时以代码 0 退出

docker - docker compose 中的环境变量