Docker撰写/群集:使用撰写文件的网络名称

时间:2020-02-23 15:46:39

标签: docker docker-compose docker-swarm docker-networking

我使用一个看起来像这样的撰写文件:

version: '3.7'
services:
  shinyproxy:
    build: /home/shinyproxy
    deploy: 
      #replicas: 3
    user: root:root
    hostname: shinyproxy
    image: shinyproxy-example
    networks:
      - sp-example-net
    volumes:
      - type: bind
        source: /var/run/docker.sock
        target: /var/run/docker.sock
      - type: bind
        source: /home/shinyproxy/application.yml
        target: /opt/shinyproxy/application.yml  
....

networks:
  sp-example-net:
    driver: overlay
    attachable: true

此Shinyproxy应用程序使用以下.yml文件

proxy:
  port: 5000
  template-path: /opt/shinyproxy/templates/2col
  authentication: keycloak
  admin-groups: admins
  users:
  - name: jack
    password: password
    groups: admins
  - name: jeff
    password: password
  container-backend: docker-swarm
  docker:
      internal-networking: true
      container-network: sp-example-net
  specs:
  - id: 01_hello
    display-name: Hello Application
    description: Application which demonstrates the basics of a Shiny app
    container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
    container-image: openanalytics/shinyproxy-demo
    container-network: "${proxy.docker.container-network}"
    access-groups: test
  - id: euler
    display-name: Euler's number
    container-cmd: ["R", "-e", "shiny::runApp('/root/euler')"]
    container-image: euler-docker
    container-network: "${proxy.docker.container-network}"
    access-groups: test

要部署堆栈,我运行以下命令:

docker stack deploy -c docker-compose.yml test

这将导致以下结果:创建网络test_sp-example-net

sp-example _ net的存在使我的网络名称是test_sp-example_net

是否可以防止我的网络名称出现这种组合?

谢谢!

0 个答案:

没有答案