Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With Docker Compose logs are not displayed after restart #4890

Closed
apolitical-engineering opened this issue Aug 25, 2021 · 8 comments · Fixed by #5254
Closed

With Docker Compose logs are not displayed after restart #4890

apolitical-engineering opened this issue Aug 25, 2021 · 8 comments · Fixed by #5254
Assignees
Labels
bug Something isn't working

Comments

@apolitical-engineering
Copy link

apolitical-engineering commented Aug 25, 2021

Expected Behavior

After modifying a file, the service gets restarted as expected and logs are displayed on the Tilt dashboard.

image

Current Behavior

After modifying a file, the service gets restarted as expected but logs are no longer displayed on the Tilt dashboard.

image

Steps to Reproduce

Using the images attached above as reference:

  1. Run tilt up with Docker Compose
  2. Check the logs for the people-api
  3. Modify a file related to the people-api
  4. Check that the people-api gets restarted
  5. Check the logs for the people-api (no longer displayed)

Tiltfile

watch_file('./.env')
docker_compose('./docker-compose.yml')

Context

tilt doctor Output

Tilt: v0.22.5, built 2021-08-20
System: darwin-amd64

Docker

  • Host: [default]
  • Server Version: 20.10.8
  • API Version: 1.41
  • Builder: 2

Kubernetes

  • Env: docker-for-desktop
  • Context: docker-desktop
  • Cluster Name: docker-desktop
  • Namespace: default
  • Container Runtime: docker
  • Version: v1.19.7
  • Cluster Local Registry: none

About Your Use Case

The issue has started after 17th August. The logs are key for the development experience. We must have reliable restarts and the logs should still be displayed on the Tilt dashboard.

@apolitical-engineering apolitical-engineering added the bug Something isn't working label Aug 25, 2021
@nicks
Copy link
Member

nicks commented Aug 27, 2021

Hi @apolitical-engineering ! Thanks for reporting this issue.

I tried to reproduce this a few different ways, but haven't seen the problem you're describing. You say this started happening on August 17th. Do you have any ideas what changed?

Can you try running tilt up on our docker-compose sample project?
https://github.com/tilt-dev/express-redis-docker
And see if the issue reproduces there? That would help us narrow down if the bug is triggered by something on your machine, or if it's triggered by something in your Tiltfile.

@nicks
Copy link
Member

nicks commented Aug 27, 2021

Also, can you run:

docker-compose version

?

The docker-compose output in your screenshot looks ... off to me. I've never seen docker-compose print something like

Container people-api Recreated

@apolitical-engineering
Copy link
Author

apolitical-engineering commented Aug 30, 2021

Hi Nick,

Thanks a lot for the quick reply and support!

The issue was indeed related to the Docker Compose version.

It seems like, for some reason, the experimental feature "use Docker Compose V2 release candidate" was enabled on the Docker App. In order to solve the issue, that experimental feature on the Docker Dashboard must be disabled.

image

image

@nicks
Copy link
Member

nicks commented Aug 30, 2021

ooooh nice find. i wonder if this is a docker-compose v2 bug that they plan to fix? maybe we should emit a warning or log if you're using the new experimental docker-compose v2

@milas
Copy link
Contributor

milas commented Sep 1, 2021

See docker/compose-cli#2001 docker/compose #8554 for upstream issue

(EDIT: Fixed issue number, Compose has been moving repos so some links got broken)

@milas
Copy link
Contributor

milas commented Sep 1, 2021

maybe we should emit a warning or log if you're using the new experimental docker-compose v2

FWIW this seems reasonable to me, especially since it's still in beta but being rolled out to Docker for Mac users to canary incrementally.

Another possible short-term solution [for Docker for Mac users] could be for Tilt to probe for docker-compose-v1 in PATH and use that if it exists: the disable-v2/enable-v2 subcommands seem to write config into ~/.docker/features.json and the main docker-compose binary acts as a trampoline to conditionally exec that based on config at startup.

@nicksieger nicksieger self-assigned this Dec 6, 2021
@nicksieger
Copy link
Member

nicksieger commented Dec 6, 2021

@apolitical-engineering if you have a chance, would you mind seeing if you can still reproduce this with recent Tilt and docker-compose?

I used tilt-dev/tilt-example-docker-compose#6 and ran tilt up with Tilt v0.23.2, docker 20.10.11, docker-compose v2.2.1. I requested http://localhost:3000 to generate some log output, then ran docker restart tilt-example-docker-compose_app_1 and made more requests. The log messages continued after restart.

@nicks
Copy link
Member

nicks commented Dec 6, 2021

@nicksieger I reprod earlier today. Try using the restart button in the tilt UI or 'tilt trigger' in the cli

(From the upstream bug report, I suspect it's an issue with how docker compose replaces the container, so I would expect a direct container restart to work correctly)

nicksieger added a commit that referenced this issue Dec 6, 2021
* dockercompose: greenlight dc version 2.2 or later

Fixes #4890.

* wordsmith: verbs

* dockercompose: remove TestPreferComposeV1

* dockercompose: rid v1 in variable name

* wordsmith: more english/simplify error message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants