0

I have a problem with starting my_app on Azure Web App Service for containers. I followed few tutorials and checked this amswer but I still get the following error:

ERROR - Exception in multi-container config parsing: YamlException: (Line: 22, Col: 9, Idx: 498) - (Line: 22, Col: 37, Idx: 526): Bind mount must start with ${WEBAPP_STORAGE_HOME}.

My docker-compose file looks like this:

version: '3'

services:
  db:
    container_name: my_app_django_db
    image: postgres:14.5-alpine
    volumes:
        - postgres_data:/var/lib/postgresql/data/
    networks:
      - my_app_network
    env_file:
      - ./.env.prod
      
  app:
    container_name: my_app_django_app
    build:
      context: ./backend
      dockerfile: Dockerfile.prod
    restart: always
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - ./backend/:/usr/src/backend/
    networks:
      - my_app_network
    ports:
      - 8000:8000
    env_file:
      - ./.env.prod
    depends_on:
      - db

  react:
    container_name: my_app_react_app
    build:
      context: ./frontend
      dockerfile: Dockerfile.prod
    restart: always
    command: npm start
    volumes:
      - ./frontend/:/usr/src/frontend/
    networks:
      - my_app_network
    ports:
      - 3000:3000
    env_file:
      - ./.env.prod
    depends_on:
      - app
  
  redis:
    container_name: my_app_redis
    image: redis:7-alpine
    ports:
      - 6379:6379
    networks:
      - my_app_network

  celery_worker:
    container_name: my_app_celery_worker
    restart: always
    build:
      context: ./backend
    command: celery -A my_app_settings worker --loglevel=info --logfile=logs/celery.log
    volumes:
      - ./backend:/usr/src/backend
    networks:
      - my_app_network
    env_file:
      - ./.env.prod
    depends_on:
      - db
      - redis
      - app

  celery-beat:
    container_name: my_app_celery_beat
    build: ./backend
    command: celery -A my_app_settings beat -l info
    volumes:
      - ./backend:/usr/src/backend
    networks:
      - my_app_network
    env_file:
      - ./.env.prod
    depends_on:
      - db
      - redis
      - app

  nginx:
    container_name: my_app_nginx
    restart: always
    build: ./azure/nginx

    ports:
      - "8080:8080"
    networks:
      - my_app_network
    volumes:
      - static_volume:/home/app/web/staticfiles
      - media_volume:/home/app/web/mediafiles
    depends_on:
      - app

volumes:
  postgres_data:
  static_volume:
  media_volume:

networks:
  my_app_network:
    driver: bridge

My path mapping in App Service configuration looks like this: enter image description here

It seems that error (lie 22) refers to volume in postgres:14.5-alpine but I don't know how to fix this error.

Adrian
  • 725
  • 4
  • 18
  • I'd expect a hosted cloud service wouldn't be able to access the files on your local system. In the `app` container, can you delete the `volumes:` block, and use the code built into your image? That seems like it'd help this specific issue. – David Maze Jan 11 '23 at 11:49
  • I tried it and Azure doesn't respond to that change. Error still remains. – Adrian Jan 11 '23 at 12:48
  • It looks like you probably need to make similar changes to `app`, `react`, `celery_worker`, and `celery-beat`, if you haven't yet. That error message describes `volumes:` entries where the left-hand side is a host path. – David Maze Jan 11 '23 at 13:59

0 Answers0