pl-jay
pl-jay

Reputation: 1100

How to run the Docker image to see the changes made on script?

Dockerfile is look like this:

FROM python:3

ADD my_script.py /

RUN pip install pystrich

CMD [ "python", "./my_script.py" ]

This runs smoothly, whatever the output is from my_script.py, docker run command gives that output.

Once I made changes on my_script.py, do I need to re-run the docker build command and run that image again to see the changes from output?

Upvotes: 0

Views: 85

Answers (1)

Mihai
Mihai

Reputation: 10757

Yes. You need to rebuild the image because you add it to the image at build time.

You can avoid the re-build if you map the file as a volume when you run the container.

FROM python:3

RUN pip install pystrich

CMD [ "python", "/my_script.py" ]
docker run -v my_script.py:/my_script.py ...

Upvotes: 1

Related Questions