Closed sanv92 closed 7 years ago
Just for clarity.
Are you running in swarm mode with an overlay network? If so, is it swarm 1.12 or greater?
Could you share the dockerfile(s)/images and docker run commands and/or docker-compose template?
no it's not swarm, it's just 1-one server, with 3 containers. 1) Nginx on dokcer-compose works fine Caddy on docker-compose works fine
2) When I run on server via Docker run Nginx works fine Caddy not working
Works only this example on producation:
fastcgi / php-fpm.wordpress_net:9000 php {
index index.php
}
I found something strange, maybe this will helps find problem: I made my docker-compose and run it on macOS, debian, centos, with next configuration for php:
fastcgi / phpfpm:9000 php {
index index.php
}
same again for macOS, debian, centos, but with network:
fastcgi / phpfpm.caddy_network:9000 php {
index index.php
}
1) MacOS - works 2) debian - works 3) Centos - works
============================== docker-compose configuration:
version: '2'
services:
### DATABASES #############################
mariadb:
image: mariadb:latest
volumes:
- ./mysql/:/var/lib/mysql/:rw
container_name: mariadb_container
#network_mode: "host"
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: homestead
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
networks:
- dev_network
### PHP-FPM #############################
phpfpm:
build:
context: ./public
dockerfile: Dockerfile
container_name: phpfpm_container
#network_mode: "host"
expose:
- "9000"
networks:
- dev_network
### WEBSERVER #############################
caddy:
image: registry.gitlab.com/container_images/caddy
container_name: caddy_container
volumes_from:
- "phpfpm"
volumes:
- ./containers/caddy/:/etc/caddy/:rw
#network_mode: "host"
ports:
- "80:80"
- "443:443"
networks:
- dev_network
networks:
dev_network:
driver: bridge
This may be better suited for our forum, since I'm not sure/convinced it's a bug in Caddy itself, might just be a misconfiguration of a Docker container or something. Feel free to ask here: https://forum.caddyserver.com - where the container gurus tend to hang out more!
I am using Docker with [caddy + php-fpm] containers, where I created own network. Network name is wordpress_net. Why on nginx it's works fine, but on caddy, I have this strange problem with this configuration.
I need use this [container_name].[network_name] php-fpm.wordpress_net
Instead of this php-fpm
for nginx and other soft, enough just write php-fpm.
Example: root@69f36ea04b37:/srv/default# getent hosts php-fpm 172.18.0.3 php-fpm
root@69f36ea04b37:/srv/default# getent hosts php-fpm.wordpress_net 172.18.0.3 php-fpm.wordpress_net
=======
It's strange, why this not working with php-fpm?
My tests: 1) Nginx + php-fpm (separate containers) in host network - works fine Caddy + php-fpm (separate containers) in host network - works fine 2) Nginx + php-fpm (separate containers) in my custom network "wordpress_net" - fine Caddy + php-fpm (separate containers) in my custom network "wordpress_net" - fail