Docker remote API port bindings example

$ docker run -p host_ip:host_port:container_port image_name
POST /containers/create
{
"Image": image_id,
"ExposedPorts": {
"container_port/tcp": {}
}
}
POST /containers/(id)/start
{
"id": id,
"PortBindings": {
"container_port/tcp": [
{
"HostIp": "host_ip", // Strings, not numbers here
"HostPort": "host_port"
}
]
}
}

--

--

--

Senior Software Development Engineer @ Amazon. Trumpet player, drum corps enthusiast.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kevan Ahlquist

Kevan Ahlquist

Senior Software Development Engineer @ Amazon. Trumpet player, drum corps enthusiast.

More from Medium

Kubernetes — Deploying A Docker Image To A Local Cluster

Install Docker in Windows and deploy Spring boot Micro Service

A Glimpse About docker

Spring boot docker application deployment using Jenkins pipeline