[英]Docker can't run the file
When I prescribe docker-compose up, the following error comes out, which I don't quite understand how to fix!当我开 docker-compose up 时,出现以下错误,我不太明白如何修复!
ERROR: for a1e9335fc0e8_bot Cannot start service tgbot: failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: exec: "python3 main.py": executable file not found in $PATH: unknown错误:对于 a1e9335fc0e8_bot 无法启动服务 tgbot:无法创建 shim:OCI 运行时创建失败:runc 创建失败:无法启动容器进程:exec:“python3 main.py”:在 $PATH 中找不到可执行文件:未知
My Dockerfile:我的 Dockerfile:
FROM python:latest
WORKDIR /src
COPY req.txt /src
RUN pip install -r req.txt
COPY . /src
My docker-compose.yml:我的 docker-compose.yml:
version: "3.1"
services:
db:
container_name: database
image: sameersbn/postgresql:10-2
environment:
PG_PASSWORD: $PGPASSWORD
restart: always
ports:
- 5432:5432
networks:
- botnet
volumes:
- ./pgdata:/var/lib/postgresql
tgbot:
container_name: bot
build:
context: .
command:
- python3 main.py
restart: always
networks:
- botnet
env_file:
- ".env"
depends_on:
- db
networks:
botnet:
driver: bridge
Your command:
is in the array format, so compose thinks that the executable file is called python3 main.py
.您的
command:
是数组格式,因此 compose 认为可执行文件名为python3 main.py
。 That doesn't exist.那是不存在的。
Change it to this and it'll work把它改成这个,它会工作的
tgbot:
container_name: bot
build:
context: .
command: python3 main.py
restart: always
networks:
- botnet
env_file:
- ".env"
depends_on:
- db
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.