How do you add a path to PYTHONPATH
in a Dockerfile? So that when the container is run it has the correct PYTHONPATH
? I'm completely new to Docker.
I've added ENV PYTHONPATH "${PYTHONPATH}:/control"
to the Dockerfile as I want to add the directory /control
to PYTHONPATH
.
When I access the container's bash with docker exec -it trusting_spence bash
and open python and run the commands below the directory control
is not on the list.
import sys print(sys.path)
FROM python:2
RUN pip install requests pymongo
RUN mkdir control
COPY control_file/ /control
ENV PYTHONPATH "${PYTHONPATH}:/control"
CMD ["python","control/control_file/job.py"]