Home > Software design >  Persist container/app in docker desktop list
Persist container/app in docker desktop list

Time:10-31

Just started with docker on windows. It's probable something conceptual I do not get, but let me describe my issue.

I Installed docker desktop, pulled some images like SQL server, mysql, redis. All works fine. My question is about the list of containers/apps in the docker desktop. All those above mentioned applications appear in that list and I can just easily start/stop those by clicking a start/stop button that appears when I hover over them in that list. If a container is stopped the icon turns gray and if running it's green.

Now I have build a Restull webapi in visual studio. I can build the docker image from it and next run it in docker by using "docker run --rm -it -p 44307:80 -p 44308:443 --detach " and a bunch of other parameters from a command line. Works just fine and the container appears in the Containers / Apps list in docker desktop with a green icon.

BUT if I stop the container, the icon does not turn gray, the line completely disappears. If I want to start it again, I have to run the command from the command line again.

My question it this: how do I make that container stay in that Containers / Apps list so I can restart it again with the right parameters by just using that convenient play button and not having to type all those parameters?

Thanks

CodePudding user response:

In the example, the container is started with docker run ... --rm .... The parameter --rm stands for "remove" or "cleanup", i.e. if the container is stopped, it is also removed. Hence, if we drop the --rm parameter, the container should still be there when we stop it.

It should be noticed, however, that the container does not "change". Changes we make to the code are, w.l.o.g., not reflected in the container.

  • Related