[RAILS] Error: Error response from daemon: No such container:

Premise

When I tried to stop the container with docker-compose down, the mysterious container was connected to the mysterious network and I used the time that I could stop it, so I will write it as a memorandum.

environment

・ Docker-compose version 1.25.5

Solutions

The order is as follows.

  1. Try docker-compose down
  2. Check the network to see if it is connected to the container
  3. Disconnect the container from the network

1. Try docker-compose down

In my case, when I tried docker-compose down, the network rails_api_default came out as active.

$ docker-compose down
Removing network rails_api_default
ERROR: error while removing network: network rails_api_default id ... has active endpoints

2. Check the network to see if it is connected to the container

I looked up rails_api_default and found that it was connected to a container called 966766894bfb_rails_api_app_1.

However, when I tried docker-compose ps -a here, this container was not displayed, so I didn't know who it was.

If you have similar experience and know the cause, I would appreciate it if you could let me know.

$ docker network inspect rails_api_default
[
    {
        "Name": "rails_api_default",
        "Id": "e22a339dc85a3d7ce7c60bcab218bd939ff9f5578addb6b1d937b5e9ba1f2e7e",
        ....
        "Containers": {
            "966766894bfb110d4a66963f5af423d9f8e2e33a8259e1cca0ced238e5980196": {
                "Name": "966766894bfb_rails_api_app_1",
                ....
            }
        },
    }
]

3. Disconnect the container from the network

All you have to do is disconnect the mysterious container and the mysterious network. When I searched various sites, I found a way to disconnect with rm, but it didn't work for me. It worked fine with docker network disconnect -f <networkName> <containerName>.

docker network disconnect -f rails_api_default 966766894bfb_rails_api_app_1

Recommended Posts

Error: Error response from daemon: No such container:
Error response from daemon: conflict: Conflict when trying to create Docker container, so solution
[Android] no such table error solution
About No Method Error