Docker Commit

  • Share this blog:


Docker Commit

This command will enable you to update the image you’re using by installing the required tools and packages and save it to be used by other users. The commit command enables you to save a container to an image to be reusable.


 -a, --author="" Author (e.g., "John Hannibal Smith <>")
 -c, --change=[] Apply specified Dockerfile instructions while committing the image
 -m, --message="" Commit message
 -p, --pause=true Pause container during commit





Learn Docker by Tekslate - Fastest growing sector in the industry. Explore "Docker Training" Videos and course is aligned with industry needs & developed by industry veterans. Tekslate will turn you into Docker Expert.




The Demo will start by using an Ubuntu image and install Nginx web server on it and save it locally and on my local docker hub registry.

Step 1: Run the container and open it from the base image

$ sudo docker run -i -t ubuntu /bin/bash

Step 2: Install required packages and tools

/# apt-get install nginx

Step 3: Exit the container

/# exit

Step 4: Find the edited container ID

$ sudo docker ps -a

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES
238c9baddb08        Ubuntu              "/bin/bash"         3 days ago          Up 59 minutes                                     walid

Step 5: Commit the image

$ sudo docker commit -m="A new nginx image" --author="washraf" 238c9baddb08 washraf/nginx


Step 6: Check the image $sudo docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
walid/nginx         latest              91064f90fa2c        32 seconds ago      206.5 MB
ubuntu              latest              91e54dfb1179        6 weeks ago         188.3 MB
hello-world         latest              af340544ed62        8 weeks ago         960 B

Step 7: inspect the image

$sudo docker inspect walid/nginx

… The data will appear as configured

Step 8: Run the container from the new Image

$ sudo docker run walid/nginx $ sudo docker run -i -t walid/nginx /bin/bash

About Author
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated

Get stories of change makers and innovators from the startup ecosystem in your inbox