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

Docker compose tiny improvements #1426

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yvolchkov
Copy link

@yvolchkov yvolchkov commented Dec 27, 2024

Assign names to containers that need to be accessible from the browser

as discussed offline I dropped this commit to preserve compatibility with existing reverse proxy setups.

Just in case, a description of what has been here before is in the quotation block below

Giving containers explicit names makes it much easier to set up a reverse proxy with proper SSL termination. Within the same Docker Compose environment, you can now reference containers by name (e.g., http://teslalogger:5000), enabling a reverse proxy (such as Caddy or Nginx) to:

  • Connect internally to the named container (e.g., teslalogger)
  • Provide HTTPS encryption on the external-facing side
    This internal name resolution simplifies configuration and helps maintain a clean, secure setup.

add init flag.

Enabling the init flag allows the container to handle and forward signals correctly, which drastically speeds up shutdown times. Here’s what changes:

  • Before: Stopping the container (docker compose down) could take more than 10 seconds.
  • After: With init enabled, the same operation now completes in about 1.4 seconds.

This improvement occurs because the minimal “init” process (PID 1) inside the container properly manages child processes and signals, preventing long shutdown delays.
Bellow is a demonstration. Notice the timer at the right side of the terminal.

asciicast

With this flag container responds way faster to shutdown command
@yvolchkov yvolchkov force-pushed the docker-compose-improvements branch from f5428d9 to 3a2638b Compare December 29, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant