Binding a port to a host interface using the REST API

后端 未结 3 2031
南笙
南笙 2021-02-05 11:08

The documentation for the commandline interface says the following:

To bind a port of the container to a specific interface of the host system, use the

3条回答
  •  情深已故
    2021-02-05 11:13

    Starting containers with PortBindings in the HostConfig was deprecated in v1.10 and removed in v1.12.

    Both these configuration parameters should now be included when creating the container.

    POST /containers/create
    
    {
        "Image": image_id,
        "ExposedPorts": {
            "22/tcp": {}
        },
        "HostConfig": {
            "PortBindings": { "22/tcp": [{ "HostPort": "" }] }
        }
    }
    

提交回复
热议问题