简体   繁体   中英

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. How do I expose this port from container to host? Is it not same as TCP/UDP? When I run docker run -p 36412:36412 myimage , I get below error.

Invalid proto: sctp

From reading source code , the general form of the docker run -p option is

docker run -p ipAddr:hostPort:containerPort/proto

Critically, the "protocol" part of this is allowed to be any of tcp , udp , or sctp ; it is lowercased, and defaults to tcp if not specified.

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. The below example maps port 36412 on the host to 36412 in the container.

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

Docker Port Documentation

How to publish or expose a port when running a container

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM