Docker Community Forums

Share and learn in the Docker community.

Docker don't seem to copy `server.py` file and restaurants container is restarting frequently

dir structure of my project

├── docker-compose.yml
├── restaurants
└── services
    ├── nginx
    │   ├── Dockerfile
    │   └── dev.conf
    └── restaurants
        ├── Dockerfile
        ├── requirements.txt
        └── server.py

4 directories, 6 files

content of my docker-compose.yml

version: '3.7'

services:

  nginx:
    build:
      context: ./services/nginx
      dockerfile: Dockerfile
    restart: always
    ports:
      - 8000:80
    depends_on:
      - restaurants

  restaurants: 
    restart: always
    build:
      context: ./services/restaurants
      dockerfile: Dockerfile
    ports:
      - "8001:8000"
    volumes:
      - './restaurants:/usr/src/app'

(py37async) [14:33:49] vchauh336:foodDel $ docker ps
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                          PORTS                  NAMES
9cef0cef2bb1        fooddel_nginx         "nginx -g 'daemon of…"   2 hours ago         Up 2 hours                      0.0.0.0:8000->80/tcp   fooddel_nginx_1
bfbc892ae8f9        fooddel_restaurants   "python -u /usr/src/…"   2 hours ago         Restarting (2) 40 seconds ago                          fooddel_restaurants_1

(py37async) [14:31:52] vchauh336:foodDel $ docker logs -f bfbc892ae8f9457e272b478c3cbe6072ca93dd2151638552c5d5fe828278af26
python: can't open file '/usr/src/app/server.py': [Errno 2] No such file or directory
python: can't open file '/usr/src/app/server.py': [Errno 2] No such file or directory
python: can't open file '/usr/src/app/server.py': [Errno 2] No such file or directory
python: can't open file '/usr/src/app/server.py': [Errno 2] No such file or directory
python: can't open file '/usr/src/app/server.py': [Errno 2] No such file or directory