Open cmacdonald opened 5 years ago
I think (...) that the first time you run a docker exposing that port, it actually uses the port you request - but then the port is not available for the next time you run a docker exposing that port, so it automatically maps to a different one.
I.e., it is docker
not the jig
doing that, as far as I understand.
Yeah, by default Docker uses a random port on the host side so that containers that require the same port don't collide (i.e., we could both run a MySQL container on a server without colliding with each other).
We can add in some explicit port mappings within the jig
(after the workshop, currently have no bandwidth) that are passed through to Docker.
After starting jig in interact mode, this command gives you the actual mapping:
docker port $(docker ps -aql)
If you expose 50000/tcp
like us, you can request just the port number using:
docker inspect --format='{{(index (index .NetworkSettings.Ports "50000/tcp") 0).HostPort}}' $(docker ps -aql)
Hence its difficult to document which ports a user should connect to. See for example this from Terrier:
The jig could simply assume that it should expose the ports as they were requested.