docker ports
Say you have an integration test environment where Docker ports are assigned randomly and cannot be assigned statically (due to the potential for port conflicts). Is there a quick was to stash the exposed port in a env variable?
Start a sample container for the example:
So basically we want to stash the exposed port 32769
in a variable. docker port
to the rescue. And since the internal application port is static, that makes our job even easier.
sed
for the win: