公布Docker集装箱港口 [英] Exposing Docker Container Ports

查看:131
本文介绍了公布Docker集装箱港口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我明白为了公开Docker容器中的端口,可以使用 -p 标志(例如 -p 1-100:1- 100 )。但是有没有一个很好的方法来将大量可能的端口从容器暴露给主机?例如,如果我正在运行一个存储在VM中的容器中的路由器,并且我想将容器中的所有端口从32768上升到65535,是否有一个很好的方法?就这样,我试过使用 -p 标志,并抱怨内存分配错误。

解决方案

Nvm我想出了我的误会。 -P 是我想要的,我想公开,而不是明确地映射端口。


I understand that to expose ports in a docker container, you can use the -p flag (e.g. -p 1-100:1-100). But is there a nice way to expose a large percentage of possible ports from the container to the host machine? For instance if I am running a router of sorts in a container that lives in a VM, and I would like to expose all ports in the container from 32768 upwards to 65535, is there a nice way to do this? As it stands I've tried using the -p flag and it complains about memory allocation errors.

解决方案

Nvm. I figured out my misunderstanding. -P is what I want, and I want to expose and not explicitly map ports.

这篇关于公布Docker集装箱港口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆