Confused about Docker Commit not saving image

The following is likely a misunderstanding on my part, so any help is appreciated.

I am using the official wordpress:latest image. By default, the docker compose file creates two volumes - one for the database and one for files. I am playing around with running these directly within the container, so have removed the volume statements. For the purposes of this post, let’s not drill down on why :slight_smile: - separate topic. Suffice to say that the instances that do NOT use volumes seem to be much quicker.

After making some initial changes to my WordPress instance (add/remove plugins, etc) I am trying to create images using Docker Commit (one for each container). The commit commands run without errors, the images are created and I can create a docker compose file that successfully launches WordPress from these two new images.

However, the resultant WordPress environment never reflect the changes I made (adding plugins, etc). I just get prompted again as if I am at a fresh WordPress install i.e. the state before I made my plugin changes.

Since I am just starting out with Docker in earnest, I’d like to understand why this is happening. I see a couple of potential explanations.

  1. Do I need to pause or stop containers before I commit to an image or can I apply it to a running container?

  2. Are there any issues with committing to an image using the same image name i.e. essentially updating the image, rather than creating a new one?

Thank you.