creating container using docker http api with port configuration (ExposedPorts and PortBindings)



I was trying to create docker container using http REST service with the option to configure port bindings. The documentation is great but somehow doesn't work as when we post, it has to be really specific / small json footprint is required.

So I use postman for this and post to the following url. I am spinning up a container called MyContainer

http://mydocker-host:2375/v1.35/containers/create?name=MyContainer

You probably will be able to create the container but might not get port bindings to work correctly.

Here are the json that works, after so many tries. I would try to post only those stuff you required to make the change.



Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm