3
I started to study the use of Docker and a question arose that I still can not understand:
Imagine that I have a python script that I want to run inside my container, so I go there and create the following DockerFile
FROM python:3
ADD hello_world.py /
CMD [ "python", "./hello_world.py" ]
So far everything 100%, I created the image, climbed the container and managed to perform the tests I needed in my development environment.
Imagine that now I just want to make a small change to my code hello_world.py
to perform another test.
Do I need to perform the whole procedure again? Create the image, upload it and etc?
In my mind it seems unproductive, after all it would be much easier for me to just run the script on my machine. And use the container only to make the final tests creating an approval environment.
Does Docker really work this way? Isn’t it meant for the programmer to test while developing? Or am I using it incorrectly?
Use Docker in development and production, and we use the option
-v
to link between the machine folder and the container during development, php work, then apache takes care of identifying the file changes and no need to upload the container again, in its example as the executed command is a script I believe I have to drop and move the container up again to Update the script, but with the-v
saves time in creating the new image– Antonio