-
-
Notifications
You must be signed in to change notification settings - Fork 788
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