Docker群无法创建具有未知RPC错误的网络

时间:2018-08-16 19:24:55

标签: docker deployment docker-swarm

我正在尝试将10个容器的解决方案部署到docker swarm中。尽管我的一个远程客户端有问题,但它在我的产品和测试服务器上都可以正常工作。

特别是在我运行命令时:

docker stack deploy --compose-file=docker-compose.yml smdr

我收到一个非常奇怪的错误消息。

_smdrnetworkwork smdr
failed to create network smdrnetwork: Error response from daemon: rpc error: code = InvalidArgument desc = name must be valid as a DNS name component

无论我如何尝试,我都无法在Google中找到这个。网络的名称是smdrnetwork,它是有效的DNS名称。但是,正如您在第一行中看到的那样,该名称显示为乱码,我觉得有些东西没有被正确地解析。

docker -v
Docker version 18.03.1-ce, build 9ee9f40

我已经将Docker从18.6降级到18.03,但是在这两个版本的docker上我的本地产品服务器上都可以正常工作。 Ubuntu 16.4作为服务器。这是我的yaml

version: '3'

services:

  #Postgres database
  nec-postgres:
    image: nec-postgres
    ports:
      - "5432:5432"
    networks:
      - smdrnetwork
    volumes: 
      - "pgdata:/var/lib/postgresql/data"
    deploy:
      mode: global
    environment:
      POSTGRES_PASSWORD: yank

  #Automatic backup for postgres
  postgres-backup:
    image: nec-postgres-backup
    networks:
      - smdrnetwork
    deploy:
      mode: global
    environment:
      - PGUSER=postgres
      - PGPASSWORD=yank
      - PREFIX=nec-backup
      - DELETE_OLDER_THAN=14400 #Delete the backups older than 10 days
      - PGDB=postgres 
      - PGHOST=nec-postgres 
    volumes:
      - "./backup:/dump"

  nec-pull:
    image: nec-pull
    networks:
      - smdrnetwork
    deploy:
      mode: global
    env_file: 
      - variables.txt
    ports:
      - "3006:3005"
    environment:
      SMDR_URL: http://nec-smdr/ 
      PULL_DELAY: 5000
      PG_HOST: nec-postgres
      PG_PASSWORD: yank

  nec-api:
    image: nec-api
    ports:
      - "3005:3005"
    networks:
      - smdrnetwork
    deploy:
      mode: global
    environment:
      APP_PORT: 3005
      PG_HOST: nec-postgres
      PG_PASSWORD: yank

  nec-smdr:
    image: nec-smdr
    ports:
      - "3007:80"    
    networks:
      - smdrnetwork
    deploy:
      mode: global

  nec-admin:
    image: nec-admin
    ports:
      - "80:80"
    networks:
      - smdrnetwork      
    deploy:
      mode: global

  portainer:
    image: portainer/portainer
    command: -H unix:///var/run/docker.sock
    networks:
      - smdrnetwork
    ports:
      - "9000:9000"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data
    deploy:
      mode: global

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.3.1
    networks: 
      - smdrnetwork
    ports:
      - "9200:9200"
      - "9300:9300"
    volumes:
      - elastic_data:/usr/share/elasticsearch/data
    deploy:
      mode: global

  kibana:
    image: docker.elastic.co/kibana/kibana:6.3.1
    networks: 
      - smdrnetwork
    ports:
      - "5601:5601"
    environment:
      ELASTICSEARCH_URL: http://elasticsearch:9200
    deploy:
      mode: global

  logstash:
    image: nec-logstash
    networks: 
      - smdrnetwork
    deploy:
      mode: global
    env_file: 
      - variables.txt
    environment:
      LS_SCHEDULE: "*/1 * * * *"
    volumes:
      - ./lastrun:/tmp/lastrun

networks:
  smdrnetwork:

volumes:
  pgdata:
  portainer_data:
  elastic_data:
  logstash_data:

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

问题是:

系统在Windows上构建,并在Linux上复制。 Windows在Linux上的行尾是错误的。