When run docker-compose up I get python: can't open file 'manage.py': [Errno 2] No such file or directory - TagMerge
3When run docker-compose up I get python: can't open file 'manage.py': [Errno 2] No such file or directoryWhen run docker-compose up I get python: can't open file 'manage.py': [Errno 2] No such file or directory

When run docker-compose up I get python: can't open file 'manage.py': [Errno 2] No such file or directory

Asked 10 months ago
22
3 answers

Remove volumes from docker-compose.yml and build again.

version: '2.1'
services:
users-service:
  container_name: users-service
  build: .
  ports:
    - 5001:5000 # expose ports - HOST:CONTAINER

there is an issue with docker-compose on ubuntu. it can't mount the volume. And as I can see you want to mount . to /usr/src/app

You would need to build the image again after you update the code.

Source: link

5

Do not run your application in a docker-machine vm by running this eval $(docker-machine env <your-vm>. But if you have, unlink the docker-machine by running eval $(docker-machine env -u)

Source: link

2

As @Fartash said, there is a problem with mounting the folder as volume in ubuntu. In order to resolve the error you can use named volume in docker.

You can simply defining new named volume in docker-compose file as below:

version: '2.1'

services:

  users-service:
    container_name: users-service
    build: .
    volumes:
      - app:/usr/src/app # the volume is defined at the end of this file
    ports:
      - 5001:5000

volumes: # You should add this and the following line
    app: # you can define any name

for more information, you can check out this link.

Source: link

Recent Questions on python

    Programming Languages