使用 compose 将容器部署到 docker swarm:发布 不允许额外的 属性 发布

Deploy container to docker swarm with compose: publish Additional property publish is not allowed

下面的不起作用,你知道为什么吗?

这是错误:发布附加属性不允许发布

version: "3"
services:
  app:
    image: golang:1.9
    working_dir: /app/src
    command: go run main.go
    volumes:
      - ./app:/app/src/
    publish:
      - "8080:8080"

docker版本

Client:
 Version:      17.06.1-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   874a737
 Built:        Thu Aug 17 22:53:38 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.07.0-ce
 API version:  1.31 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   8784753
 Built:        Tue Aug 29 17:46:50 2017
 OS/Arch:      linux/amd64
 Experimental: false

您应该使用端口而不是发布

version: "3"
services:
  app:
    image: golang:1.9
    working_dir: /app/src
    command: go run main.go
    volumes:
      - ./app:/app/src/
    ports:
      - "8080:8080"