症状
dockerの起動時に以下のようなエラーが出る。
ERROR: for app Cannot start service app: driver failed programming external connectivity on endpoint growi_app_1 (79e9ed9c43890de4098f5d07ae6bea48c4840fc5723a7351fa7b894a692cb711): Bind for 0.0.0.0:3000 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.
実際にはそのようなポートを使用した記憶はないし、自動割り当てで使用されていたとしてもコマンドがないので簡単には調べられない。
PCだとポートからジョブを探せるから簡単。
Dockerを再起動しようがdownしようが問題が解決しない。
解決策
dockerのサービスそのものを再起動する。
SSHでNASにアクセスしたうえで、
# sudo -i
# synoservice --restart pkgctl-Docker
非力なので再起動に時間はかかるがこれでエラーが出なくなる。
症状
docker-composeの起動時に以下のようなエラーが出る。
root@DS1819Plus:/volume1/docker/growi# docker-compose up -d
Creating network "growi_default" with the default driver
Creating growi_mariadb_1 ...
Creating growi_mongo_1 ... done
Creating growi_elasticsearch_1 ...
ERROR: for growi_mariadb_1 UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
ERROR: for growi_elasticsearch_1 UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
ERROR: for mariadb UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
ERROR: for elasticsearch UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).
どれもタイムアウトでエラーが出ている。以前は出なかったのに今回出たりと再現性がない。
解決策
今回たまたま台風による瞬停直後の復旧で原因が判明した。バックグランドタスクの量に影響されて時間内にぎりぎり終わらなかったりするパターンっぽい。インデックス作業とかデータスクラブなどの重めのタスクが走っていると時間内に完走できないのが原因。
"docker-compose up"時に以下のオプションを加えることでタイムアウトの時間を調節することができる。(オプションを付けない場合は60秒)
COMPOSE_HTTP_TIMEOUT=240 docker-compose up -d