AgustinCB / docker-api

Docker Remote API driver for node.js. It uses the same modem than dockerode, but the interface is promisified and with a fancier syntax.
GNU General Public License v3.0
303 stars 51 forks source link

Cannot bind port #51

Closed serhiinikitenko closed 3 years ago

serhiinikitenko commented 6 years ago

Resolved

Suertzz commented 5 years ago

how did u resolve that I have exactly the same problem @serhiinikitenko

serhiinikitenko commented 5 years ago

Hi, To bind IP port from host to docker container you need to use the next JSON:

{
        "Image": "your-image",
        "HostConfig": {
            "PortBindings": {
                "80/tcp": [ // port inside of docker container 
                    {"HostPort": "8000"} // port on host machine
                ]
            }
        },
        "ExposedPorts": {
            "80/tcp": {} // port inside of docker container 
        }
    }
Suertzz commented 5 years ago

thank you !!