这是我的podman-compose 配置文件
php8:
hostname: php8
container_name: php8
image: php8:latest
volumes:
- ./www:/var/www
- ./config/php8:/usr/local/etc/php/conf.d
restart: always
caddy:
container_name: caddy
hostname: caddy
image: caddy:latest
restart: always
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
- ./www:/srv
- ./config/caddy/data:/data
- ./config/caddy/config:/config
错误提示:
{"level":"error",
"ts":1737361804.6081245,
"logger":"http.log.error",
"msg":"dialing backend: dial tcp: lookup php8 on 114.114.114.114:53: no such host",
"request":{"remote_ip":"192.168.8.166","remote_port":"55861","client_ip":"192.168.8.166","proto":"HTTP/1.1","method":"GET","host":"www.hszh.com","
这里提示:这个主机名php8 找不到。
我的caddyfile 的配置是
http://www.hszh.com {
……
php_fastcgi * php8:9000 {
…………
}
……
}
这里的php8 是容器名称。
我不知道是怎么会事!我的 debian
就是正常的,但是我现在是用的是openEuler
系统,debian
同样的配置都是没有问题的,现在就出现了这样的问题。
请问这个情况如何处理 openeuler 需要配置?podman 需要配置?
无效的方法(尝试过添加自定义网络)
php8:
hostname: php8
container_name: php8
image: php8:latest
volumes:
- ./www:/var/www
- ./config/php8:/usr/local/etc/php/conf.d
restart: always
networks:
- my_network
caddy:
container_name: caddy
hostname: caddy
image: caddy:latest
restart: always
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
- ./www:/srv
- ./config/caddy/data:/data
- ./config/caddy/config:/config
networks:
- my_network
networks:
my_network:
name: my_custom_network
driver: bridge