0

I am using a docker container that provides me a mysql database. I would like to make it as git branches. I wish to clone to container start it, make some db changes, then start another container in which all changes are discarded.

I was trying to use this post https://www.scalyr.com/blog/create-docker-image/ I created a container, then committed, created an image from container and then another container based on this new image. Let's say I have db1, db2 containers. I start db1 rename a table, stop it and then start db2. I wish that this table name is old. But after starting db2 I see the same table name as in db1. What I am doing wrong? What am I doing wrong? Is it possible to have an independent container clone?

tgogos
  • 23,218
  • 20
  • 96
  • 128
kk2449
  • 77
  • 1
  • 8
  • ...so you really should never use `docker commit`, and I'm impressed by the lengths that post goes through to work around its shortcomings. You can't create an image based on the stock `mysql` image that contains a populated database but [Setting up MySQL and importing dump within Dockerfile](https://stackoverflow.com/questions/25920029/setting-up-mysql-and-importing-dump-within-dockerfile) includes the standard workaround. – David Maze Aug 26 '19 at 11:47
  • I already set up the mysql. I am working on this database now I need to make some backup that I could restore e.g. tomorrow – kk2449 Aug 26 '19 at 11:52

0 Answers0