Docker-compose installation had error with dns or internet access

I get with this docker-compose file this error in the log:
error PHP dns_get_record(): A temporary server error occurred. at /var/www/html/lib/private/Http/Client/DnsPinMiddleware.php#58
Host ubuntu 22.04.3

Seems to be no internet and dns from within docker as I cannot ping outside and route delivers no host dns.
I got stuck on this problem already a long time.
Without ufw enabled same problem.
may be it is iptables but I can not get a grip on it.
Host access internet is fine

docker-compose.yml:

version: ‘3’

services:
db:
image: mariadb:10.6
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW --innodb-read-only-compressed=OFF
volumes:
- ./db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
networks:
- next
app:
image: nextcloud:fpm-alpine
restart: always
links:
- db
volumes:
- ./nextcloud:/var/www/html
environment:
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
networks:
- next

web:
image: nginx
restart: always
ports:
- 9080:80
dns:
- 8.8.8.8
- 8.8.4.4
links:
- app
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./nextcloud:/var/www/html
- /etc/resolv.conf:/etc/resolv.conf:ro
volumes_from:
- app
environment:
VIRTUAL_HOST: ${DOMAINS}
LETSENCRYPT_HOST: ${DOMAINS}
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL}
networks:
- next

networks:
next:
external:
name: webproxy

Network is created with:
docker network create --attachable=true --driver=bridge --subnet=172.18.0.0/28 --gateway=172.18.0.1 webproxy

SOLVED!:

Following solutiion (I have really searched a lot but could not find this dolution)

ufw route allow proto udp from any to any port 53

1 Like

This topic was automatically closed after 6 days. New replies are no longer allowed.