简体   繁体   中英

Docker mounting image error executable file not found in $PATH: unknown

I have a directory in which code files and subdirectories are, i want to mount these files to the docker image and run the index.py

My Dockerfile looks like this:

# Selected base python version
FROM python:3.9.6

COPY requirements.txt ./

# Install all packages - see readme to create the requirements.txt
RUN pip install -r requirements.txt

# Port the container listens
EXPOSE 5000
CMD ["python3", "index.py"]

My build process is like this:

docker build -t demo .

docker run -it -p 127.0.0.1:5000:5000 demo -v "$(pwd)":/.

However, the following errors occurs:

docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "-v": executable file not found in $PATH: unknown.
ERRO[0000] error waiting for container: context canceled

What is wrong?

I tried different paths, but they all lead to the same errors. Google the error didn't lead to any solution.

The solution is to change the file:

# Selected base python version
FROM python:3.9.6

COPY requirements.txt ./

# Install all packages - see readme to create the requirements.txt
RUN pip install -r requirements.txt

# Port the container listens
EXPOSE 5000
CMD ["python3", "app/index.py"]

and run:

docker run -it -p 127.0.0.1:5000:5000 -v "$(pwd)"/:/app demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM