Answer the question
In order to leave comments, you need to log in
Why do I get the error "python: can't open file '//temp/hello_world.py': [Errno 2] No such file or directory" when running an image?
docker-compose.yml :
version: '3.9'
services:
python_runner:
build:
context: ./compilers/python
dockerfile: Dockerfile
volumes:
- ./temp:/temp
container_name: python_runner_container
environment:
- FILENAME=${FILENAME}
java_runner:
...
FROM python
ARG FILENAME_ARG
ENV FILENAME = $FILENAME_ARG
CMD python temp/${FILENAME}
docker-compose
and run it with the command: docker-compose up -d
docker run --env FILENAME=hello_world.py compilers_python_runner
python: can't open file '//temp/hello_world.py': [Errno 2] No such file or directory
docker-compose
interface and manually set the value of the variable , everything works correctly.
What is the error and how to fix it? FILENAME
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question