Reputation: 45
I would like to running docker-compose. during running react and django application, docker-compose returns the following error:
(base) dominik@Precision:~/PycharmProjects/humanet-docker$ ls
api docker-compose.prod.yml docker-compose.yml front nginx
(base) dominik@Precision:~/PycharmProjects/humanet-docker$ docker-compose ps
Name Command State Ports
------------------------------------------------------------------------------------------------------------------------------------------------------
a7c8de30f648_humanet-docker_api_1 python manage.py runserver ... Exit 127
humanet-docker_db_1 docker-entrypoint.sh postgres Up 5432/tcp
humanet-docker_front_1 docker-entrypoint.sh yarn ... Up 0.0.0.0:3000->3000/tcp,:::3000->3000/tcp
humanet-docker_nginx_1 /docker-entrypoint.sh ngin ... Up 0.0.0.0:443->443/tcp,:::443->443/tcp, 0.0.0.0:80->80/tcp,:::80->80/tcp
humanet-docker_pgadmin_1 /entrypoint.sh Up 443/tcp, 0.0.0.0:5050->80/tcp,:::5050->80/tcp
(base) dominik@Precision:~/PycharmProjects/humanet-docker$ docker-compose up
humanet-docker_pgadmin_1 is up-to-date
humanet-docker_front_1 is up-to-date
Starting a7c8de30f648_humanet-docker_api_1 ...
humanet-docker_nginx_1 is up-to-date
Starting a7c8de30f648_humanet-docker_api_1 ... error
ERROR: for a7c8de30f648_humanet-docker_api_1 Cannot start service api: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "python manage.py runserver 0.0.0.0:8000": executable file not found in $PATH: unknown
ERROR: for api Cannot start service api: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "python manage.py runserver 0.0.0.0:8000": executable file not found in $PATH: unknown
ERROR: Encountered errors while bringing up the project.
(base) dominik@Precision:~/PycharmProjects/humanet-docker$
below docker-compose.yml file from my docker
version: "3.3"
services:
front:
build: ./front
working_dir: /home/dominik/node
env_file: ./front/.env.dist
volumes:
- ./front:/home/dominik/node
- /private/etc/ssl:/etc/ssl
ports:
- 3000:3000
restart: always
tty: true
api:
build: ./api
working_dir: /home/dominik/python
command: pip install -r requirements.txt && python manage.py runserver 0.0.0.0:8000
volumes:
- ./api:/home/dominik/python
- /private/etc/ssl:/etc/ssl
ports:
- 4000:4000
- 8445:8445
restart: always
tty: true
nginx:
build: ./nginx
volumes:
- /private/etc/ssl:/etc/ssl
ports:
- 80:80
- 443:443
working_dir: /home/dominik/node
restart: always
tty: true
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: xxx
POSTGRES_USER: xxx
POSTGRES_DB: xxx
POSTGRES_HOST_AUTH_METHOD: trust
PGDATA: /data/db
volumes:
- /home/dominik/data/humanet-db:/data/db
pgadmin:
image: dpage/pgadmin4
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: xxx
PGADMIN_DEFAULT_PASSWORD: xxx
ports:
- 5050:80
volumes:
- /home/dominik/data/humanet-pgadmin:/var/lib/pgadmin
- /home/dominik/data/humanet-pgadmin/servers.json:/pgadmin4/servers.json
it is first time when docker returns my that message: Cannot start service api: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "python manage.py runserver 0.0.0.0:8000": executable file not found in $PATH: unknown
ERROR: for api Cannot start service api: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "python manage.py runserver 0.0.0.0:8000": executable file not found in $PATH: unknown ERROR: Encountered errors while bringing up the project.
how to deal with it?
Upvotes: 1
Views: 13035
Reputation: 497
Try give executable permission in yous entrypoint.sh and docker-entrypoint.sh files with the command chmod +x
before run docker-compose command.
Upvotes: 0
Reputation: 264446
Based on the error message
exec: "python manage.py runserver 0.0.0.0:8000"
It looks like you've passed the command and it's args as a single field for docker to run. E.g. if your Dockerfile contains:
ENTRYPOINT [ "python manage.py runserver 0.0.0.0:8000" ]
That will look for the full string as the executable to run, not python with the first arg manage.py, but an executable named something like
/bin/"python manage.py runserver 0.0.0.0:8000"
Instead you'd need to separate each of these arguments:
ENTRYPOINT [ "python", "manage.py", "runserver", "0.0.0.0:8000" ]
Then you get to the next issue of why you are setting the command in your compose file and if you need that.
Upvotes: 4