Search code examples
pythondockerdockerfileboot2dockerdocker-machine

How to edit source code of a python project deployed in docker


I have successfully deployed a python project in docker.Please suggest me a way to edit its source code.

Operating system: Windows 10


Solution

  • The docker approach is that it is very easy to create a new image, and that you do not modify an image, you create a new, modified one.

    So while you can docker exec in your container like 200-OK says, and then docker commit the modified image, you should not.

    You should definitely have a Dockerfile, and build a new version of your image each time something changes, like when the source code is modified.

    See https://docs.docker.com/engine/reference/builder/

    for example, you can name your new image, including the version, something like (extract from the previous link)

    $ docker build -t shykes/myapp:1.0.2 -t shykes/myapp:latest .