Docker - docker-compose down removes the container from the list
Answered
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 ?
Please sign in to leave a comment.
Hello, Bloodyrax.
Please note that there are two pairs of commands in the Docker Compose: the first one is
up
anddown
, the second one isstart
andstop
. These commands perform different actions; see this question on StackOverflow for more detail.When you
stop
the service (or the whole compose configuration), the container is not removed; it still remains created and could be run again with thestart
command. If youdown
the service, the container is completely removed; to make it run again, you should use theup
command, 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 youdown
the container, it is destroyed; that's why it disappears from the IDE UI, and you need to run theup
command to create it again. Everything in the case you described works as expected.If you want to use the container again, you should
stop
it and make it running withstart
, notup
. If you don't need the container anymore, feel free todown
it.Please let me know if you have any further questions or requests.