I have a question about how I can use docker in order to run simples python scripts. I have a directory with some python scripts, and I create a Dockerfile:
FROM python:2.7
ENV PYTHONIOENCODING UTF-8
ADD . /
WORKDIR ./
RUN pip install pandas
CMD [ "python", "./hello.py" ]
then I build using:
docker build -t hello.
and run with: `docker run hello``
My question is about change the hello.py file without build again.
Any tip here ?
I would prepare docker-compose for that. And then mount hellp.py from host to container. I am not sure whether it's possible to update running hello.py on the fly. 
So my way would be:
version: '2.1'
services:
  hello:
   image: hello
   volumes: 
     - /home/host/app/hello.py:/hello.py
So everytime you will do a change in hello.py you won't have to rebuild image just docker-compose down and docker-compose up to reflect changes in your .py application.
If you have more than one file you can mount whole directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With