Inside the container, this call returns successfully:
curl localhost:8080/swagger.json
But on the host it fails:
docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
578020ab694e f5b963d67552 "/bin/bash" 34 seconds ago Up 33 seconds 0.0.0.0:8080->8080/tcp sweet_fermat
curl localhost:8080/swagger.json
curl: (52) Empty reply from server
$ curl 0.0.0.0:8080/swagger.json
curl: (52) Empty reply from server
Using the sandbox app Algorand publishes (which is really just managing docker for you), I’m able to communicate over the exposed ports.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fd473a225486 algorand-sandbox:stable "/opt/algorand/start…" 4 minutes ago Up 4 minutes 0.0.0.0:4001-4002->4001-4002/tcp sandbox
and use curl http://0.0.0.0:4001/swagger.json to get the swagger.json.
You need to change the config.json file in the data directory, change this setting:
“EndpointAddress”: “127.0.0.1:0”,
to:
“EndpointAddress”: “127.0.0.1:8080”,
Otherwise it listens on a different port each time.