docker run -it debian bash
After entering the interactive mirror image, the results of each modification are not automatically saved. I remember it has this function. .
Even if you don’t commit, when you go in, the changes you made should be saved. .
Any changes docker makes in the container need a commit to be saved in the mirror. If you want to enter the container again and the changes are still there,
You can use docker run -idt to run the container and hang it in the background, or you can use control+p,control+q to keep the container hanging in the background without using exit after docker run -it enters the container.
docker run -idt debian bash
Then use docker attach or docker exec to enter the container for modification. It is recommended to use docker exec to enter. exec enters the container by opening another process. Therefore, using exit to exit does not affect the container to continue to run in the background. The command is as follows:
docker exec -it [container id] bash
docker attach [container id]