Docker Pi-hole部署报错排查:环境映射问题及镜像兼容错误
Pi-hole容器启动问题排查
第一个错误:services.pihole.environment must be a mapping
这个错误是因为YAML语法要求environment字段必须是键值对映射,但你的配置里environment下面全是注释行,没有实际的键值对,相当于空映射,部分Docker Compose的YAML解析器会判定无效。
解决方式二选一:
- 取消至少一个环境变量的注释并填写有效值,比如:
environment: TZ: 'Asia/Shanghai' # WEBPASSWORD: 'your-secure-password' - 如果不需要自定义任何环境变量,直接删掉整个
environment块。
第二个错误:no matching manifest for linux/mipsle in the manifest list entries
这个错误的核心原因是你用的pihole/pihole:2021.09官方镜像没有提供mipsle架构的版本,而运行OpenWRT的路由器(尤其是老型号)大多是mipsle架构。
排查与解决方向:
- 先确认主机架构:执行
docker info,查看Architecture字段,确认是不是mipsle。 - 更换支持mipsle的Pi-hole镜像:找第三方编译适配mipsle的Pi-hole镜像(注意选择可信来源),或者自己编译镜像。
- 若主机硬件支持,考虑升级到支持主流架构(比如arm64/x86_64)的设备,官方镜像对这些架构支持更完善。
原始配置代码
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
内容的提问来源于stack exchange,提问作者Jacob
相关产品推荐
相关产品推荐

