Reputation: 2845
I am trying to remove container but when i run docker-compose rm
,runs fine but when i run docker ps
then again it shows container:
root@datafinance:/tmp# docker-compose rm
Going to remove tmp_zookeeper_1_31dd890a1cbf
Are you sure? [yN] y
Removing tmp_zookeeper_1_31dd890a1cbf ... done
root@datafinance:/tmp# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
03b08e4ef0b3 confluentinc/cp-zookeeper:latest "/etc/confluent/dock…" 14 hours ago Up 14 hours docker_c_zookeeper_1_7c953dce7d69
Upvotes: 2
Views: 1579
Reputation: 31584
Use docker-compose ps
, it will show the container which only launched by docker-compose up
. If it shows there is no container, then this means this container was not launched by this docker-compose.yaml
.
And Error starting userland proxy: listen tcp 0.0.0.0:32181: bind: address already in use'
means the port 32181 is occupied either by other docker container
or other process
. You could use docker rm -f $(docker ps -qa)
to delete all containers or more you can use netstat -oanltp | grep 32181
to find which process really occupy 32181.
Finally, if for any reason you did not able to delete container as you said, you can just use service docker restart
or systemctl restart docker
to make all container down. Then repeat above docker rm xxx
.
With above steps, you can use docker compose up -d
to use your service now.
Upvotes: 1
Reputation: 18578
try this :
docker rm -f 03b08e4ef0b3
DANGER
you may also try this, but be aware that will delete everything (Containers, Images, Networks, ....)
docker system prune -a -f
when all not helped your last resort is to restart Docker daemon
service docker restart
and then repeat the steps...
Upvotes: 1
Reputation: 3512
I think what you are looking for is :
docker-compose down
which removes the containers after stopping them according to this.
According to this, docker-compose rm removes the "stopped" containers. If your container(s) are running, I think it won't remove to prevent accidents.
Upvotes: 0