tilt
tilt copied to clipboard
Tilt is not recreating containers with docker-compose
Expected Behavior
Assuming following docker-compose.yml and an "admin" service:
admin:
image: admin_svc:latest
ports:
- 4550:4550
env_file:
- compose/admin.env
volumes:
- admin_deps:/app/deps:delegated
- admin_build:/app/_build:delegated
depends_on:
- db
db:
image: postgres:13-alpine
env_file:
- compose/db.env
volumes:
- db:/var/lib/postgresql/data
ports:
- 5432:5432
Tiltfile:
docker_build("admin_svc:latest",
dockerfile='./Dockerfile',
context='./',
ssh=['default'])
docker_compose('./docker-compose.yml')
I'd assume Tilt to recreate the admin container when "admin" code is changed.
Current Behavior
It seems that when it's build once with the latest tag, it won't recreate the container:

You can see the status being up 5 minutes ago and the container been created an hour ago.
I checked the tag 5afa3f288921 with docker images:

Of course, if I nuke the containers with docker-compose rm -f, it'll work but it doesn't seem right.
Here's the Tilt output after I update the code (you can see the COPY . . not being cached as expected):

And it won't recreate the container, just deploy a tag that doesn't actually match latest in that case:

TLDR: developers are updating code to realize that it's not actually the "latest" code being ran since the container doesn't get recreated.
Thanks a lot for the help!
I tested again nuking every image:
docker images | grep admin | awk '{print $3}' | xargs -I% -P5 docker rmi -f %
Edit code and let Tilt run, container was not recreated:

Running docker images | grep admin shows the actual new image that Tilt built (the only image since I nuked everything) but unfortunately not used:

Can you include the output of tilt doctor here?
Unfortunately, there's an upstream bug in the latest Docker Compose (v2.3.3) which ships with Docker Desktop v4.6.0: https://github.com/docker/compose/issues/9291