-1

I am new to using docker.

I have pulled an image for Jenkins from the docker repository and made some changes in the Jenkins server that has been deployed via docker.

Currently this container is running on my machine,and I want run this Jenkins image with my changes on a seperate machine as well.

Is it possible to push my snapshot of the Jenkins images to some repo and then pull it on a different machine and run it there as well?

Thanks in advance

2 Answers 2

1

You should really make your image by creating a Dockerfile that makes the changes you need. That way, you can easily do it again when an updated Jenkins image comes out.

That being said, it is possible to create an image from a running container using

docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

So if your container is called mycontainer, your repository is myrepository and you want to call the image myjenkins, you'd do

docker commit mycontainer myrepository/myjenkins:latest

and then push it to the repository using

docker push myrepository/myjenkins:latest

Then, on your other machine, you can pull it and run it.

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

Comments

-1

You can use docker commit to generate a new image that includes any modifications made in the container. You can then push that image like normal.

1 Comment

This is almost never a best practice. In addition to creating a non-reproducible image, committing an image doesn't include any data that might be stored in Docker volumes; if you've manually configured Jenkins by editing configuration files, and those files are in named or anonymous volumes, committing won't preserve the changes.

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.