|
|
|
|
|
by yebyen
4586 days ago
|
|
Yes, I wrote a long wordy response and neglected to mention "docker start" which is a perfectly good way to come back to a stopped container after the first "docker run". I prefer to never keep anything important in a stopped container (for very long) without committing it back to an image, and I don't like dealing with numeric ids. Recently (it looks like you don't have this change yet) docker added the automatic naming scheme giving every container a random name of some "color_animal" pair which I think reinforces the point, stopped containers are not a place to store meaningful/persistent state information for very long. This mishmash gets run almost every day on my docker hosts to clean up after terminated experiments: docker ps -a|egrep -v 'ID|Up'|awk '{print $1}'|xargs docker rm Beware, it will delete all of the stray containers you've ever created before that are now stopped! |
|
For example a common pattern is to create a placeholder database container with reference dara as a volume, but no actual process running and no network ports. Then successive versions of the database container are started on the side, with shared access to the placeholder's volume. Later you might run a backup container on the same volume. In other words you can point to a particular dataset as a container of its own, separate of the various applications which might access it. All of these interactions are visible to docker so it can authenticate, restrict, log, or hook them in all the standard ways.
In fact internally images and containers are stored side-by-side. In future versions we are going to accentuate that similarity.