1

I use mysql image that start with this command

 docker run --name test-mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d -p 3306:3306 mysql

when docker run in background, It takes about a minute for another application can connect to port 3306.

After that I stop this container with docker stop test-mysql and then start it with docker start test-mysql. in the second case, with start command, the application can connect to port 3306, just after 5 seconds.

Now I take a snapshot from stopped container with docker commit test-mysql mysql2, and run it with docker run -d mysql2 but in this case, the application can connect to mysql2 after a minute!

So,

  1. What's happen with stopped container, that can be start and responsible just in 5 seconds but mysql image can not do it?

  2. Is there any way to take a snapshot after run container, that can be responsible in 10 seconds?

NOTE: Mysql image has an entrypoint that it takes above a minute to start.

MKM
  • 503
  • 1
  • 7
  • 16

1 Answers1

-2
  1. Take a look here: https://stackoverflow.com/a/34783353/7719775 for the first Answer.
  2. And for the second, you should take a look here https://docs.docker.com/engine/reference/commandline/commit/, but even in this case docker start will be faster than docker run command
Community
  • 1
  • 1
SteelSailor
  • 52
  • 10
  • 2
    Thank you for your reply but this is not my answer, I asked what is different between container start from stopped container and run from an image. Not definition of that! – MKM Apr 27 '17 at 07:36