'docker suprisingly persistent although it should not be

I have a docker image running for powering a wordpress site. As far as I know, Docker images are not persistent. so any change i make will be discarded once i stop the image.

however, i entered the image like "docker exec -it [IMG] bash", ran "$ apt update" and did some "$ apt install [STUFF]" and even after i have stocked the image and restarted it, the installed packages are still present.

Shouldn't they dissapear? Isn't this the reason why these docker files always contain some "$ apt install [STUFF]"?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source