banjocode Save a Modified Docker Container As An Image Using Commit

Save a Modified Docker Container As An Image Using Commit

It's easy to find a good Docker container online. Sometimes, it does require some minor changes to make it perfect. This is how you can modify a Docker container, and then save it as a new Docker image using commit

1 min read

Modify container

1. Download / Create

Download or create the container you want to use as your base.

2. Modify

Make the changes you want to do to it. It can be anything from adding files to updating software, etc.

3. Commit

The most important part, committing your changes to a new Docker image.

docker commit <name-of-container> <username>/<new-image-name>:<tag>

For example, it might look something like this.

docker commit my-container banjoanton/my-image:latest

4. Push

If you want to push your work to Docker Hub, you can do it like this.

docker push <username>/<new-image-name>

Which, in my case, would look like this.

docker push banjoanton/my-image