2

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

Operating system: Windows 10

5
  • 1
    This doesn't have much information. Did you build the image yourself, or get the image from something like Docker Hub, and now are looking to modify its contents? Commented Jan 23, 2017 at 4:51
  • I got image from docker hub and using kitematic.Yeah I am looking to modify its contents Commented Jan 23, 2017 at 4:52
  • If you need a little change then you can log inside container's bash using docker exec -it <python_container_id> bash. Commented Jan 23, 2017 at 5:09
  • No I need to edit the core Commented Jan 23, 2017 at 5:18
  • You had selected the correct answer before. No need to select another one which says essentially the same thing. Commented Jan 26, 2017 at 16:40

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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 .

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.