Help us understand the problem. What is going on with this article?

docker networkの削除ができない

ネットワークをリプレイスするために削除を試みたところ、なかなか削除がうまくいかなかったので、色々調べたのをここに備忘録残しておきます。

docker network rm ネットワーク名
# Error response from daemon: error while removing network: network ネットワーク名 id ~ has active endpoints

どうやらネットワークがまだコンテナと結びついているため削除ができないみたい。
docker network rmに強制削除のオプションはないので、リソース間の結びつきを調べて未使用コンテナを地道に消していくという作業をやらないといけない。

# ネットワーク検証
docker network inspect ネットワーク名

# "Containers"に書かれているコンテナを停止
docker stop コンテナ名

# network削除
docker network rm ネットワーク名

# 確認
docker network ls

参考

docker network rmコマンドの使い方(実例付)CE対応

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away