繁体   English   中英

我在尝试运行 docker 容器时不断收到“services.pihole.environment must be a mapping”,我的 yml 文件有问题吗?

[英]i keep getting "services.pihole.environment must be a mapping" while trying to run a docker container, is something wrong with my yml file?

尝试使用 ssh 将以下代码粘贴到 .yml 文件中以访问运行 openWRT 的主机。 我通过 vim 复制了它,我是否有可能从复制中得到奇怪的缩进错误?

当我尝试运行容器时,我收到“必须映射”错误消息,谷歌搜索后大多数人似乎说这是由于 yml 文件中的缩进错误。 如果下面的代码看起来正确,那么我可以发送我执行的命令 rest。

有人可以帮我解决这个错误吗?

更新:取消注释时区修复了它,但我现在收到错误消息“清单列表条目中没有与 linux/mipsle 匹配的清单”,这是什么意思?

version: "3.3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:2021.09
    hostname: pihole
    environment:
      # TZ: 'set timezone'
      # WEBPASSWORD: 'set a secure password here or it will be random'
    # Volumes store your data between container upgrades
    volumes:
      - './pihole/etc-pihole/:/etc/pihole/'
      - './pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/'
      - './pihole/var-log/:/var/log'
      - './pihole/etc-cont-init.d/10-fixroutes.sh:/etc/cont-init.d/10-fixroutes.sh'
    # Recommended but not required (DHCP needs NET_ADMIN)
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
    networks:
      internal:
      lan:
        ipv4_address: 192.168.1.3

networks:
  internal:
  lan:
    name: lan
    driver: macvlan
    driver_opts:
      parent: br-lan.20
    ipam:
      config:
        - subnet: 192.168.1.0/24

撰写文件的文档指出:

... environment可以使用数组或 map。...

为了让它(在句法层面上)起作用,我们可以:

  • 将其显式设置为空数组: environment: []
  • 删除该行,或
  • 之后评论两行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM