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

Rootless podman container health problem #166

Open
Tokariew opened this issue Aug 31, 2022 · 4 comments
Open

Rootless podman container health problem #166

Tokariew opened this issue Aug 31, 2022 · 4 comments
Labels
question Further information is requested

Comments

@Tokariew
Copy link

Hi, I running rootless podman with your container. Podman report me that the status is unhealthy.

podman create \
    --label io.containers.autoupdate=registry \
    --name speedtest \
    --net lab \
    --network-alias speedtest \
    ghcr.io/miguelndecarvalho/speedtest-exporter:latest

After some investigating it seems that when i don't publish port to my "host" network it fail connecting to localhost

podman exec -it speedtest sh
/app $ wget localhost:9798
Connecting to localhost:9798 ([::1]:9798)
wget: can't connect to remote host: Connection refused
/app $ wget http://127.0.0.1:9798
Connecting to 127.0.0.1:9798 (127.0.0.1:9798)
saving to 'index.html'
index.html           100% |*****************************************************************|    88  0:00:00 ETA
'index.html' saved

So maybe healthcheck should check 127.0.0.1 instead of localhost?
Publishing port is not necessary, to access speedtest-exporter on the same container network

@bergpb
Copy link

bergpb commented Sep 7, 2022

I have a similar problem, first example running the container inside a swarm cluster running in a Raspberry Pi, the second one in my local machine:
image
Healthcheck fails in Raspberry Pi, but works fine running outside them.

@MiguelNdeCarvalho
Copy link
Owner

Hey,

@Tokariew @bergpb sorry for the late response but as far as I can see, the problem is related to localhost not being resolved to 127.0.0.1? If not I can change this.

Thanks,
MiguelNdeCarvalho

@MiguelNdeCarvalho MiguelNdeCarvalho added the question Further information is requested label Sep 11, 2022
@Tokariew
Copy link
Author

Tokariew commented Sep 11, 2022

I not sure what podman is doing…
I know that running with following command containers stay healthy.

podman run --rm -it --health-cmd "wget --no-verbose --tries=1 --spider http://127.0.0.1:9798/" --health-timeout
=10s ghcr.io/miguelndecarvalho/speedtest-exporter

After installing apk add bind-tools and checking with dig/nslookup the localhost is resolved correctly to 127.0.0.1 on the container, but still i can't download with wget. ping localhost from container works fine too.

@bergpb
Copy link

bergpb commented Sep 12, 2022

I saw a similar problem in another project related to alpine images too: louislam/uptime-kuma#295
Since this, the alpine docker images for uptimekuma project were checked as deprecated: https://hub.docker.com/r/louislam/uptime-kuma

I can make some tests and confirm it the solution installing bind-tools works for swarm.
Also, another option is to change the base image to a debian based, which can be ~37MB greater than alpine image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants