How to access a running container inside an action


I am running an action and as part of it im running a docker image

docker run -d -p 8080:8080 myimage.

This image is exposing port 8080. The container is starting, i can see it running if i do docker ps -a, but, when i do a curl to the container,

curl http://localhost:8080

it does not answer

What is the right way to access a running docker image inside an action?


What kind of access are you thinking of? Starting with docker logs to see what’s going on is probably a good start.

But if you do something like

docker run -d -p 8080:8080 myimage
docker ps -a
curl http://localhost:8080

it is possible that the server simply is not up yet by the time the curl request arrives (depending on the server maybe even likely). Repeating the request a few times with a little delay in between may be enough to wait until the container is ready.