docker-compose up時に、 WARNING: Found orphan containers (~) for this project. | クズリーマンのカス備忘録

docker-compose up時に、 WARNING: Found orphan containers (~) for this project.

docker-logo docker
スポンサーリンク

事象

docker-compose up -d 

を実行したら以下のメッセージが出力されました。

$ docker-compose up -d
Creating network "wp-sub-dir_default" with the default driver
WARNING: Found orphan containers (wp-sub-dir_https-portal_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.

コンテナは起動するので、メッセージにもある通り、WARNING(警告)レベルってことですね。致命的ではない。

原因

docker-comopse.yml

を使い回すと出やすいらしいです。

ただ、僕は今回はつかい回すということはしとりません。

docker-compose.yml
の中から記述を消しただけです。

対応

メッセージにもありますが、

docker-compose up
時に

–remove-orphans

オプションをつけると良いみたいです。

やってみます。

一回、downさせる

$ docker-compose down
Stopping wp-sub          ... done
Stopping wp-sub-dir_db_1 ... done
WARNING: Found orphan containers (wp-sub-dir_https-portal_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Removing wp-sub          ... done
Removing wp-sub-dir_db_1 ... done
Removing network wp-sub-dir_default

お、docker-compose down
のときにもWARNING出るんですね。

では、オプションつけて、起動

r$ docker-compose up -d --remove-orphans
Creating network "wp-sub-dir_default" with the default driver
Removing orphan container "wp-sub-dir_https-portal_1"
Creating wp-sub          ... done
Creating wp-sub-dir_db_1 ... done

警告メッセージ消えました。

「Removing orphan container “wp-sub-dir_https-portal_1″」
とも出てますね。

ちなみに、
orphan
って、孤児(こじ、みなしご)という意味です。

参考にしたサイト

【Docker】orphan containerとは何か?WARNING: Found orphan containers for this project.が表示される原因と対処法
Dockerで新たにコンテナを起動した時に「WARNING: Found orphan containers (コンテナ名) for this project.」という警告が表示されることがある。特に、別のプロジェクトで使っている、dock

コメント

タイトルとURLをコピーしました