Home > database >  How to forbid auto deleting a docker container after exit
How to forbid auto deleting a docker container after exit

Time:10-12

I was using wsl2 Ubuntu 20.04 with docker. I created a container in wsl, but when I exit from the container, the docker automatically deleted the container. Yet I didn't have this problem when I created a container from windows command line.

How to prevent docker from auto deleting the container I created in wsl command line?

CodePudding user response:

It appears you may have created the container with docker run [...] --rm [...]. This will cause the container to be removed when the container exits. To prevent auto-removal, be sure not to include --rm when creating your container

  • Related