官方文档,才是正途-docker-compose
2017-05-26 09:17
555 查看
需要的ingress网络映射,还是host宿主机端口映射:
https://docs.docker.com/compose/compose-file/#secrets
========================
docker service create --name web \
--publish mode=host,published=80,target=80 \
nginx
==========================
Note: When mapping ports in the
Note: The long syntax is new in v3.2
https://docs.docker.com/compose/compose-file/#secrets
========================
docker service create --name web \
--publish mode=host,published=80,target=80 \
nginx
==========================
ports
Expose ports.SHORT SYNTAX
Either specify both ports (HOST:CONTAINER), or just the container port (a random host port will be chosen).
Note: When mapping ports in the
HOST:CONTAINERformat, you may experience erroneous results when using a container port lower than 60, because YAML will parse numbers in the format
xx:yyas sexagesimal (base 60). For this reason, we recommend always explicitly specifying your port mappings as strings.
ports: - "3000" - "3000-3005" - "8000:8000" - "9090-9091:8080-8081" - "49100:22" - "127.0.0.1:8001:8001" - "127.0.0.1:5000-5010:5000-5010" - "6060:6060/udp"
LONG SYNTAX
The long form syntax allows the configuration of additional fields that can’t be expressed in the short form.target: the port inside the container
published: the publicly exposed port
protocol: the port protocol (
tcpor
udp)
mode:
hostfor publishing a host port on each node, or
ingressfor a swarm mode port which will be load balanced.
ports: - target: 80 published: 8080 protocol: tcp mode: host
Note: The long syntax is new in v3.2
相关文章推荐
- Docker CE for CentOS的安装(对官方文档的翻译)
- [Docker 官方文档] 理解 Docker
- Ubuntu安装Docker(官方文档翻译)
- [Docker 官方文档] 理解 Docker
- docker官方文档中的dns,link,expose,publish
- 官方文档才是王道:PonyDebugger安装坑的感悟;
- docker官方文档-part2
- Docker Sample applications 文档 ——Quickstart: Compose and Django
- 如何写docker-compose.yml,Docker compose file 参考文档
- docker安装telnet 命令【官方文档】
- Docker1.8 官方中文文档
- Docker 官方速查文档下载、安装和使用指南
- Dockerfile文件编写官方文档
- docker官方文档笔记
- 不需要瞎折腾,官方文档才是终极
- 【Docker官方文档】理解Docker
- docker官方文档
- Docker compose file 中文参考文档
- Docker-compose 到 Kubernetes 的迁移工具!