官方文档,才是正途-docker-compose

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了官方文档,才是正途-docker-compose相关的知识,希望对你有一定的参考价值。

需要的ingress网络映射,还是host宿主机端口映射:

 

https://docs.docker.com/compose/compose-file/#secrets

 

========================

docker service create --name web \
--publish mode=host,published=80,target=80 \

==========================

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:CONTAINER format, you may experience erroneous results when using a container port lower than 60, because YAML will parse numbers in the format xx:yy as 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 (tcp or udp)
  • modehost for publishing a host port on each node, or ingress for 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-compose的主要内容,如果未能解决你的问题,请参考以下文章

基础软件照搬开源不可取,自力更生才是正途

基础软件照搬开源不可取,自力更生才是正途

基础软件照搬开源不可取,自力更生才是正途

citus 多租户应用开发(官方文档)

centos安装docker,docker-compose

Docker异常docker-compose up throw UnicodeDecodeError: 'ascii' codec can't decode byte 0x(代