Docker - docker-compose down removes the container from the list
已回答
Hello,
First to tell that I am not familliar with docker so,
I just started using the integrated docker UI in webstorm, the problem is that I have couple projects which I run with docker.
If I stop some of the containers, then If I run `docker-compose up` it shows httpd (pid 8) already running
So I have to run `docker-compose down` first and then `docker-compose up` that it is how through the CLI.
But now I want to use the webstorm UI and the problem here is that when I stop the container → then I have to “make it down”, which is removing it from the list and I cannot start it again, i have to go to the CLI again and start it from there.
Is there any solution for that ?
请先登录再写评论。
Hello, Bloodyrax.
Please note that there are two pairs of commands in the Docker Compose: the first one is
upanddown, the second one isstartandstop. These commands perform different actions; see this question on StackOverflow for more detail.When you
stopthe service (or the whole compose configuration), the container is not removed; it still remains created and could be run again with thestartcommand. If youdownthe service, the container is completely removed; to make it run again, you should use theupcommand, which builds and runs containers.So, when you're trying to run the already existing container with
up, the Docker Compose tries to build the container and can't do it because the container with the necessary name already exists; that's why you see the error. If youdownthe container, it is destroyed; that's why it disappears from the IDE UI, and you need to run theupcommand to create it again. Everything in the case you described works as expected.If you want to use the container again, you should
stopit and make it running withstart, notup. If you don't need the container anymore, feel free todownit.Please let me know if you have any further questions or requests.