user7392500
user7392500

Reputation: 33

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

Upvotes: 2

Views: 3083

Answers (2)

user2915097
user2915097

Reputation: 32216

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 .

Upvotes: 0

VonC
VonC

Reputation: 1329082

I got image from docker hub and using kitematic.Yeah I am looking to modify its contents
I need to edit the core

Then you need to define your own image, starting with

 FROM my_Image_From_DockerHub

And you can COPY your modifications from your disk to that new image, overwriting the python sources need.

From there, docker build then docker run your new image.

Upvotes: 1

Related Questions