In my build pipeline I want to perform a simple smoke test of my system by running the docker container I just built and calls its Ping method. However, in the CI environment I cannot access the running container using localhost and I have no idea how else to proceed.
- docker build -t myregistry/mycontainer . # Smoke test - docker run -d --rm -p 5000:5000 myregistry/mycontainer:latest - curl --fail --connect-timeout 5 --max-time 10 --retry 25 --retry-delay 5 --retry-max-time 200 --retry-connrefused "localhost:5000/status/ping"
It just responds with connection refused. The container starts no problem, as is visible when running the container without
-d --rm, so I’m guessing it’s because
localhost is not available to access the container.