Accessing services to test containers before deploy



Following the section above, it works locally on my machine but getting this when I try it on CircleCI. Are the docs up to date?

# Next ping the healthcheck URL.
docker exec test-container curl --retry 10 http://localhost:3000
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed connect to localhost:3000; Connection refused
Exited with code 7

See this build if you need more info:

Any suggestions?



I recommend SSHing to debug and find out why. Running ss -plntu or netstat -plntu in that test-container will show you what’s listening.


Hi Alex, you’re missing a flag. The command from the docs is:

docker exec my-app curl --retry 10 --retry-connrefused http://localhost:8080

Note from the curl man page


In addition to the other conditions, consider ECONNREFUSED as a transient error too for --retry. This option is used together with --retry.

You can tell there were no retries on your build because the failed step took 0 seconds to execute, but curl uses exponential backoff so each retry should wait 1, 2, 4, 8 seconds and so on.


Cool looks like that’s the issue, just need to upgrade our Centos 7 container to include the newer version of cURL now :confused: (It’s failing now because it has v7.29 but it needs v7.52).

Thanks for the help :slight_smile: