I have what seems like a very strange issue that I hope someone has hit before.
I have a docker-compose file that houses a service for redis. Nothing special, I just grab the latest redis from docker hub. I went in to redeploy today and I normally run --force-recreate
to down/up the containers, but when I attempt to run --force-recreate
today, I am getting weird errors I have not seen before (and this worked fine yesterday).
Strangely enough though, running normal down/up commands works and there is no issue. Am I missing something?
Here are the commands that work to down/up my system without errors:
docker-compose -f docker-compose.prod.yml down
docker-compose -f docker-compose.prod.yml up -d
Here is the command that should be fine, but it fails with ‘ContainerConfig’ errors for redis’ docker-compose:
docker-compose -f docker-compose.prod.yml up -d --force-recreate
Output…
docker-compose -f docker-compose.prod.yml up -d --force-recreate
Recreating app_redis_1 ...
ERROR: for app_redis_1 'ContainerConfig'
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'
[88001] Failed to execute script docker-compose
Here is the simple docker-compose
config for the redis service:
version: '3.8'
services:
redis:
image: redis:latest
restart: always
ports:
- "6379"
2
Answers
As noted in countless posts here, and as noted in the comments by @ChrisBecke this was a cause of depreciated commands in Docker. It is now 2024 and things have updated.
For whatever reason,
--force-recreate
withdocker-compose
now fails on my production system after system updates, whiledocker compose up -d --force-recreate
works as expected. (Notice the removal of-
)Weird thing is I host on DigitalOcean and did run updates the other day via
apt-get...
and I did notice docker being updated...but this error was not easy to figure out the cause which is why I asked here. It also hasn't effected my staging env so not sure what the cause for the original commands not working is...In 2024 you just need to use the following command "docker compose up"! I tried and succeeded