Do you want to keep the previous changes made in the container after docker-compose goes up every time?

  docker, question

What I tested was reserved. For example, I created a new table in mysql mirror database.
againdocker-compose upLater, the previous table still exists.
But can’t understand, don’tdocker-compose upDidn’t you regenerate the instance of the mirror?
YML can actually generate only one instance per Docker-Compose? To reset, the previous instance must be manually deleted

docker-compose upThe existing container will be used preferentially instead of recreating the container.

The following methods can solve your problem:

docker-compose up -d --force-recreateUse--force-recreateYou can force the container to be rebuilt (otherwise the container will only be rebuilt if the container configuration has changed)

docker-compose downStop all containers and delete the containers (so that they can be used next timedocker-compose upWhen it will be a new container)