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 HEALTHCHECK fails due to trying to access Martin at IPv6 #1674

Closed
SmallhillCZ opened this issue Jan 31, 2025 · 2 comments · Fixed by #1686
Closed

Docker HEALTHCHECK fails due to trying to access Martin at IPv6 #1674

SmallhillCZ opened this issue Jan 31, 2025 · 2 comments · Fixed by #1686

Comments

@SmallhillCZ
Copy link

SmallhillCZ commented Jan 31, 2025

Hi, with the new version we got a problem, where HEALTHCHECK instruction (introduced in #1397) fails due to trying to access Martin at IPv6 (localhost is translated to [::1]), while Martin is listening on IPv4 in the container.

Tried to run the healthcheck command inside the running container and found out the following:

This fails, makes the container status unhealthy and prevents the container to be recognized by our reverse proxy (Traefik), thus not being online:

/ # wget --spider http://localhost:3000/health
Connecting to localhost:3000 ([::1]:3000)
wget: can't connect to remote host: Connection refused

This works okay:

/ # wget --spider http://127.0.0.1:3000/health
Connecting to 127.0.0.1:3000 (127.0.0.1:3000)
remote file exists
@SmallhillCZ SmallhillCZ changed the title Docker HEALTHCHECK fails Docker HEALTHCHECK fails in v0.015.0 Jan 31, 2025
@SmallhillCZ SmallhillCZ changed the title Docker HEALTHCHECK fails in v0.015.0 Docker HEALTHCHECK fails in v0.15.0 Jan 31, 2025
@CommanderStorm
Copy link
Collaborator

Good point.
Our default is to only bind to ipv4..

pub const LISTEN_ADDRESSES_DEFAULT: &str = "0.0.0.0:3000";

I don't know of better options than chaning it to this.
What do you think?

HEALTHCHECK CMD wget --spider http://127.0.0.1:3000/health || exit 1

@CommanderStorm CommanderStorm changed the title Docker HEALTHCHECK fails in v0.15.0 Docker HEALTHCHECK fails due to trying to access Martin at IPv6 Feb 1, 2025
@CommanderStorm CommanderStorm changed the title Docker HEALTHCHECK fails due to trying to access Martin at IPv6 Docker HEALTHCHECK fails due to trying to access Martin at IPv6 Feb 1, 2025
@CommanderStorm CommanderStorm removed the bug label Feb 1, 2025
@SmallhillCZ
Copy link
Author

I don't know of better options than chaning it to this. What do you think?

Either that, or somehow rewrite the generated /etc/hosts at runtime and remove the localhost entry pointing to [::1], but just using 127.0.0.1 seems like a much simpler solution.

CommanderStorm added a commit that referenced this issue Feb 12, 2025
This PR changes the docker-`HEALTHCHECK` only query ipv4 by default.

Thanks @SmallhillCZ for the report ❤️
Resolves: #1674
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 a pull request may close this issue.

2 participants