slimtoolkit / slimtoolkit/slim

Need access to other docker container when probing

Open
#761 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
23.4k
Forks
840
PR merge metrics
No merged PRs in 30d

Description

The docker image I try to slim down contains a service that will try to connect to postgres, kafka etc at startup. If I run the service locally I have postgres and kafka as docker images running locally. Now when I try to slim down the docker container it also needs to connect to these other postgres/kafka containers to be able to start before it's possible to probe the service.

I've tried different combinations with --expose, --publish-port, --new-expose etc, but it doesn't seem to work.

./slim build --show-clogs=true --expose 8088 --http-probe-cmd /actuator/health/readiness --target my-container:1.0.0 --tag mycontainer:slim --publish-port 5432
But the log from the service in my-container say Connection to localhost:5432 refused

So if my-container needs to connect to port 5432 on the host. Is that possible? Which of all parameters should be used for that?

If I would just run my docker container, then something like this works to connect to the correct ports: docker run --network host my-container:1.0.0 so then I tried something like:
./slim build --show-clogs=true --http-probe-cmd /actuator/health/readiness --target my-container:1.0.0 --tag mycontainer:slim --http-probe-ports 8088 --network=host but still not working. Then I get this log:

cmd=build info=container ip='127.0.0.1' message='obtained IP address'
time="2025-03-18T12:42:12+01:00" level=error msg="channel.NewCommandClient: NewClient error = wait timeout"
time="2025-03-18T12:42:12+01:00" level=error msg="ipc.NewClient init error = wait timeout"
slim: container stdout:
slim: container stderr:
slim: end of container logs =============
slim: container stdout:
slim: container stderr:
slim: end of container logs =============
cmd=build info=container status='crashed' id='2de68bf7252e4128b498da44557b68ab690a36cb07ee792ff7a25363d255a454' exit.code='2'
cmd=build state=exited code=-999 version=linux/amd64|Transformer|1.40.11|1b271555882eacdfb4e6598d6d0552e9b9b1449b|2024-02-02_01:36:22PM location.exe=/home/marcus/slimtoolkit/dist_linux location.sensor=/home/marcus/slimtoolkit/dist_linux/slim-sensor sensor.filemode=-rwxr-xr-x sensor.volume=slim-sensor.1.40.11-6-g965a82ed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two ./slim build commands in the issue, including the --publish-port and --network=host variants, and inspect how container networking is configured during HTTP probing. Done means establishing whether the probe container can reach the host's PostgreSQL or Kafka ports and documenting or correcting the relevant behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
devops, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.