带有 nginx-proxy 的 Docker:不允许附加属性名称

问题描述 投票:0回答:1

从 ubuntu 18 升级到 Ubuntu 20.04.6 LTS 后,Docker 停止工作

我正在使用 docker-compose 但它完全停止工作。所以我切换到“docker compose”

我现在正在尝试使用

docker compose -f /home/ubuntu/docker/configs/compose-thestack.yml up -d

我收到的错误是..

validating /home/ubuntu/docker/configs/compose-thestack.yml: services.mysql-yo2c.volumes.0 Additional property name is not allowed

我怀疑还会有更多的错误。

之前与docker-compose一起使用的yml文件的内容是。

version: "3.3"

services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    environment:
      HTTPS_METHOD: noredirect
      HSTS: 0
      DHPARAM_GENERATION: 0   
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - /home/ubuntu/docker/configs/certs:/etc/nginx/certs
      - /home/ubuntu/docker/configs/scripts/config:/bin/config
      - /home/ubuntu/docker/configs/mods/nginx.conf:/etc/nginx/conf.d/nginx.conf
      - type: bind
        source: /home/ubuntu/docker/domains/nginx/html
        target: /var/www/html
      - type: bind
        source: /home/ubuntu/docker/configs/scripts/nginx.tmpl
        target: /app/nginx.tmpl
      - type: bind
        name: common
        source: /home/ubuntu/docker/configs/scripts
        target: /common
    networks:
      nginx-proxy:
        ipv4_address: 172.28.0.254


##################################################################
  mysql-yo2c:
    depends_on:
      - "nginx-proxy"
    image: mysql:5.7.29
    volumes:
      - type: volume
        name: db_yo2c
        source: /home/ubuntu/docker/data_yo2c
        target: /var/lib/mysql
      - /home/ubuntu/docker/configs/scripts/config:/bin/config 
    restart: always
    networks:
      - nginx-proxy
    container_name: mysql-yo2c

##################################################################
  portainer:
    depends_on:
      - "nginx-proxy"
    image: portainer/portainer
    restart: unless-stopped
    ports:
      - 9000:9000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /home/ubuntu/docker/portainer/data:/data
      - /home/ubuntu/docker/configs/certs:/etc/nginx/certs
    container_name: portainer


##################################################################
# yo2c.com 
##################################################################
  yo2c-com:
    depends_on:
      - "mysql-yo2c"
    links:
      - "mysql-yo2c:mysqlhost"
    image: yo2c/php7_4_8_apache:v3
#    build:
#      context: /home/ubuntu/docker/configs/mods
#      dockerfile: php_7.4.8-apache.RUN
    expose:
      - 80
    restart: always
    environment:
      - VIRTUAL_HOST=yo2c.com,*.yo2c.com
      - MYSQL_HOST=mysqlhost
      - MYSQL_DATABASE=wp_www_yo2c_com
      - DHPARAM_GENERATION=0
      - HTTPS_METHOD=redirect
      - HSTS=0
    volumes:
      - /home/ubuntu/docker/domains/www.yo2c.com:/var/www/html
      - /home/ubuntu/docker/domains/errors:/var/www/html/errors
      - /home/ubuntu/docker/configs/scripts/config:/bin/config
      - /home/ubuntu/docker/configs/php7/php.ini:/usr/local/etc/php/conf.d/docker.ini
      - type: bind
        name: common
        source: /home/ubuntu/docker/configs/scripts
        target: /common
    networks:
      - nginx-proxy
    container_name: yo2c-com

networks:
  nginx-proxy:
    ipam:
      driver: default
      config:
        - subnet: 172.28.0.0/24


Docker 在过去几年里似乎发生了很大的变化,我什至不知道我们是否仍然可以使用 yml 文件和 compose。不管怎样,如果你能告诉我如何正确加载这些内容,并在 nginx-proxy 不再以这种方式工作时纠正我,任何帮助都将不胜感激。

我正在尝试使用

docker compose
期待它能像
docker-compose
一样工作 但我收到错误。

docker
1个回答
0
投票

我设法通过将 compose.yml 更改为这个来解决这个问题...

version: "3.3"

services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    environment:
      HTTPS_METHOD: noredirect
      HSTS: 0
      DHPARAM_GENERATION: 0   
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "/home/ubuntu/docker/configs/certs:/etc/nginx/certs"
      - "/home/ubuntu/docker/configs/scripts/config:/bin/config"
      - "/home/ubuntu/docker/configs/mods/nginx.conf:/etc/nginx/conf.d/nginx.conf"
      - type: bind
        source: /home/ubuntu/docker/domains/nginx/html
        target: /var/www/html
      - type: bind
        source: /home/ubuntu/docker/configs/scripts/nginx.tmpl
        target: /app/nginx.tmpl
    networks:
      nginx-proxy:
        ipv4_address: 172.28.0.254


##################################################################
  mysql-yo2c:
    depends_on:
      - "nginx-proxy"
    image: mysql:5.7.29
    volumes:
      - "/home/ubuntu/docker/data_yo2c:/var/lib/mysql"
      - "/home/ubuntu/docker/configs/scripts/config:/bin/config" 
    restart: always
    networks:
      - nginx-proxy
    container_name: mysql-yo2c

##################################################################
  portainer:
    depends_on:
      - "nginx-proxy"
    image: portainer/portainer
    restart: unless-stopped
    ports:
      - 9000:9000
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/home/ubuntu/docker/portainer/data:/data"
      - "/home/ubuntu/docker/configs/certs:/etc/nginx/certs"
    container_name: portainer


##################################################################
# yo2c.com 
# Setup for PHP-7 / Mysql 5_7 Sites off the ketoric db server
##################################################################
  yo2c-com:
    depends_on:
      - "mysql-yo2c"
    links:
      - "mysql-yo2c:mysqlhost"
    image: yo2c/php7_4_8_apache:v3
#    build:
#      context: /home/ubuntu/docker/configs/mods
#      dockerfile: php_7.4.8-apache.RUN
    expose:
      - 80
    restart: always
    environment:
      - VIRTUAL_HOST=yo2c.com,*.yo2c.com
      - MYSQL_HOST=mysqlhost
      - MYSQL_DATABASE=wp_www_yo2c_com
      - DHPARAM_GENERATION=0
      - HTTPS_METHOD=redirect
      - HSTS=0
    volumes:
      - "/home/ubuntu/docker/domains/www.yo2c.com:/var/www/html"
      - "/home/ubuntu/docker/domains/errors:/var/www/html/errors"
      - "/home/ubuntu/docker/configs/scripts/config:/bin/config"
      - "/home/ubuntu/docker/configs/php7/php.ini:/usr/local/etc/php/conf.d/docker.ini"
      - type: bind
        source: /home/ubuntu/docker/configs/scripts
        target: /common
    networks:
      - nginx-proxy
    container_name: yo2c-com



networks:
  nginx-proxy:
    ipam:
      driver: default
      config:
        - subnet: 172.28.0.0/24

然后我使用了这个命令。

docker-compose -f compose-thestack.yml up -d --remove-orphans

© www.soinside.com 2019 - 2024. All rights reserved.