dockerのバージョンアップ後、docker-compose up -d --build
などでコンテナを再起動しようとした際に以下のようなエラーが発生
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 81, in main
File "compose/cli/main.py", line 203, in perform_command
File "compose/metrics/decorator.py", line 18, in wrapper
File "compose/cli/main.py", line 1186, in up
File "compose/cli/main.py", line 1182, in up
File "compose/project.py", line 702, in up
File "compose/parallel.py", line 108, in parallel_execute
File "compose/parallel.py", line 206, in producer
File "compose/project.py", line 688, in do
File "compose/service.py", line 581, in execute_convergence_plan
File "compose/service.py", line 503, in _execute_convergence_recreate
File "compose/parallel.py", line 108, in parallel_execute
File "compose/parallel.py", line 206, in producer
File "compose/service.py", line 496, in recreate
File "compose/service.py", line 615, in recreate_container
File "compose/service.py", line 334, in create_container
File "compose/service.py", line 922, in _get_container_create_options
File "compose/service.py", line 962, in _build_container_volume_options
File "compose/service.py", line 1549, in merge_volume_bindings
File "compose/service.py", line 1579, in get_container_data_volumes
KeyError: 'ContainerConfig'
version
docker 20.10.9 -> 27.0.2に上げてから発生
docker : Docker version 27.0.2, build 912c1dd
docker-compose : docker-compose version 1.29.2, build 5becea4c
原因
どうやらコンテナを一度立ち上げたままの状態で再度upしようとすると発生している様子?
-> downしてから再度upすることで解決
--rmi all --volumes --remove-orphans
: down + image,volume,未定義コンテナの削除
# docker-compose down --rmi all --volumes --remove-orphans
# docker-compose up -d --build