Docker generates a new image through the container

Tomcat container on article has been done and the webapps.dist delete webapps webapps directory name into the operation, the normal access
Here Insert Picture Description
so when we want to generate a new image based on this tomcat container, container generated this image there will be no webapps.dist this directory does not need to make any modification to a successful visit.

The figure may know by id tomcat container is c2de5293a386, so to generate a new image by the following command:

docker commit -a="jiejie" -m="tomcat without webapps.dist" c2de5293a386 mytomcat:1.0

-a: name defines OF
-m: described
later is to generate the image name and the container id + version number corresponding mirror

Here Insert Picture Description

This is to generate a return to the id mirror, docker images look:
Here Insert Picture Description
new image already exists

The next direct use of the new image is generated tomcat container, without any modification of file:

docker run -it -p 8888:8080 mytomcat:1.0

tomcat next visit, a bit long, be patient, eventually visit a success:
Here Insert Picture Description

to sum up

If you are not satisfied with the current image, can modify according to their own want to do, then the modified container modeled to generate a new image, followed by the new image to generate container ok.

Published 289 original articles · won praise 302 · views 50000 +

Guess you like

Origin blog.csdn.net/weixin_38106322/article/details/105100550