[英]Exposing SCTP port from docker container to host
My docker container (sctp server) is running on sctp with port number 36412. However, my sctp client on the host machine unable to communicate with the container. 我的Docker容器(sctp服务器)在端口号为36412的sctp上运行。但是,主机上的我的sctp客户端无法与该容器通信。 How do I expose this port from container to host?
如何将此端口从容器公开到主机? Is it not same as TCP/UDP?
它与TCP / UDP不同吗? When I run
docker run -p 36412:36412 myimage
, I get below error. 当我运行
docker run -p 36412:36412 myimage
,出现以下错误。
Invalid proto: sctp
From reading source code , the general form of the docker run -p
option is 通过阅读源代码 ,
docker run -p
选项的一般形式为
docker run -p ipAddr:hostPort:containerPort/proto
Critically, the "protocol" part of this is allowed to be any of tcp
, udp
, or sctp
; 至关重要的是,它的“协议”部分允许为
tcp
, udp
或sctp
任何一个; it is lowercased, and defaults to tcp
if not specified. 它是小写的,如果未指定,则默认为
tcp
。
It looks like for your application, you should be able to 看起来对于您的应用程序,您应该能够
docker run -p 36412:36412/sctp ...
Use the -p flag when running to to map an open port on your host machine to the container port. 在运行时使用-p标志将主机上的开放端口映射到容器端口。 The below example maps port 36412 on the host to 36412 in the container.
下面的示例将主机上的端口36412映射到容器中的36412。
docker run -p 36412:36412 mysctpimage
To view the ports running on your container and where they are mapping to: 要查看容器上运行的端口以及它们映射到的端口:
docker port <containerId>
This will tell you what port and protocol the container is mapping to your host machine. 这将告诉您容器映射到主机的端口和协议。 For example running a simple WebApi project may yield: 80/tcp -> 0.0.0.0:32768
例如,运行一个简单的WebApi项目可能会产生:80 / tcp-> 0.0.0.0:32768
Docker Port Documentation Docker端口文档
How to publish or expose a port when running a container 运行容器时如何发布或公开端口
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.