Docker script files update whitout build files again

I have a question about how I can use docker to run python scripts. I have a directory with some python scripts and I am creating a Docker file:

FROM python:2.7 ENV PYTHONIOENCODING UTF-8 ADD . / WORKDIR ./ RUN pip install pandas CMD [ "python", "./hello.py" ] 

then I will build using:

docker build -t hello.

and run with: `docker run hello``

My question is about changing the hello.py file without assembly again.

Any feedback here?

+5
source share
1 answer

I have prepared docker-compose for this. And then install hellp.py from the host to the container. I am not sure if it is possible to update the launch of hello.py on the fly.

So my way:

 version: '2.1' services: hello: image: hello volumes: - /home/host/app/hello.py:/hello.py 

Therefore, every time you make changes to hello.py yo , you don’t have to rebuild the image only of docker-compose down and docker-compose up to reflect the changes in your .py application.

If you have several files, you can install the entire directory.

0
source

Source: https://habr.com/ru/post/1270832/


All Articles