I'm facing an issue on raspberry pi 4 with php in Docker saying it cannot resolve the name of my redis server.
I'm using the nextcloud image linuxserver/nextcloud which relies on nginx+php-fpm with the following docker-compose.yml:
services:
db:
image: yobasystems/alpine-mariadb
volumes:
- "./db/mysql:/var/lib/mysql" # location where you persist DB files
- "./db/restore:/restore" # mount folder to store mysql_dump file
environment:
- TZ=Europe/Paris
env_file: .env
restart: always
redis:
image: redis:alpine
restart: always
volumes:
- "./redis:/data"
nextcloud:
depends_on:
- db
- redis
image: linuxserver/nextcloud
container_name: nextcloud
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Paris
...
and in my nextcloud config.php:
'memcache.local' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'redis',
'port' => 6379,
),
'memcache.locking' => '\\OC\\Memcache\\Redis',
Running this, I get the error "php_network_getaddresses: getaddrinfo failed: Name does not resolve" although pinging redis from the container using the following command works fine:
pi@raspberrypi /docker/nextcloud $ docker exec nextcloud ping redis
PING redis (172.19.0.2): 56 data bytes
64 bytes from 172.19.0.2: seq=0 ttl=64 time=0.247 ms
64 bytes from 172.19.0.2: seq=1 ttl=64 time=0.303 ms
64 bytes from 172.19.0.2: seq=2 ttl=64 time=0.172 ms
64 bytes from 172.19.0.2: seq=3 ttl=64 time=0.341 ms
When I change 'redis' by the redis IP in "host"=>'redis' in the nextcloud config.php, everything works fine in nextcloud/redis communication but I don't like to hardcode this.
I looked at the different questions around the same topic but didn't find something really usefull...
Any help appreciated...