I want to modify the contents of the container through docker’s /bin/bash and commit the new image.
The unsuccessful operation process is as follows:
docker run -t -i docker-wordpress-nginx /bin/bash
Enter container bash
Nginx’s conf file was modified.
Exit the container and run
Still the original images.
Can you tell me how to save the changes bash made in docker and how to commit?
PS1: How to commit to automatically tag a new image and invalidate the previous template?
PS2: If you get three versions of tag v1, v2, v3 and v3 through modification and commit, can you delete V1 and V2 and keep V3? Is there an association (stacking) relationship between individual images?
docker commit --help docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
A1. if A1. commit does not add a tag, it defaults to the latest. if it is modified on the latest image and then committed does not add a tag, it will replace the original latest. generally, the original latest image will be tagged before committing.
A2. v1, v2 and v3 are all tags you added yourself.
docker rmi username/repo:v1You can delete itv1This tag does not affect other tags.
At the same time, if v1, v2 and v3 tags are typed on the same image id, they are deletedv1Tag will not delete the corresponding image