Last active
August 29, 2015 14:04
-
-
Save apatil/dee124fd868871f18cb7 to your computer and use it in GitHub Desktop.
How to get Docker to choose the ports using the remote API?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -v -H "Content-Type: application/json" -X POST \ | |
-d '{"Cmd":["/bin/sleep","infinity"],"Image":"ubuntu:14.04", "ExposedPorts":{"22/tcp":{}}}' \ | |
http://127.0.0.1:4243/containers/create?name=testcontainer | |
curl -v -H "Content-Type: application/json" -X POST \ | |
-d '{"PortBindings": { "22/tcp": [{ "HostPort": "11022" }]} }' \ | |
http://127.0.0.1:4243/containers/testcontainer/start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Answer: