-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Container ports are reassigned upon restart #31
Comments
@dmartin, I think I'm leaning toward the idea of fixing this by allowing an explicit port range to be configured for challenge ports (likely via an environment variable). If the configuration is set, then |
@jrolli, I think that works. Perhaps it should also be mentioned in the documentation to adjust An aside: looking into this sent me down a rabbit hole of looking into how Docker actually allocates ephemeral ports, which turns out to be... pretty poorly? If I'm understanding correctly, they don't use bind(2) to get an available port at all, but just maintain their own map and hope for the best. Actually asking the OS for an available port has been a TODO for 7 years(!) |
This addresses the issue of an instances ports changing on restart by providing a configuration knob to assign ports to `cmgr`. If the `CMGR_PORTS` environment variable is present, `cmgr` will assume that it has the ability to fully control/assign the ports in this range without further coordination with the OS or another process. This allows it to assign a port number to instances before creating the instance with Docker which then enables Docker to keep the same port between restarts of the same container. Supersedes #31 Fixes #32
Fixed in v0.11.1 |
Challenge containers are launched with an
always
restart policy, but unfortunately Docker reassigns host ports upon restart when an explicit port mapping is not specified up front. This causes the port information in the database to become inaccurate if a container restarts.For example:
The text was updated successfully, but these errors were encountered: