Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when initiating NC #2045

Closed
MarcS1975 opened this issue Aug 1, 2023 · 4 comments
Closed

Issue when initiating NC #2045

MarcS1975 opened this issue Aug 1, 2023 · 4 comments
Labels

Comments

@MarcS1975
Copy link

MarcS1975 commented Aug 1, 2023

After installing the official Nextcloud docker image and launching via compose file (Base version - apache), I access the NC server and when trying to initiate setup of the admin user, the web page stops with the following error:

Error
Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for db failed: Temporary failure in name resolution

Create an admin account-->

@joshtrichards
Copy link
Member

DNS resolution is failing for your db container in your Docker environment (at least from the perspective of the NC app container you're attempting to connect to it).

Usually the cause is something like:

  • not adding a shared Docker network between the containers
  • Docker networking in general being broken on the host for some reason
  • referencing the incorrect container name
  • etc.

Since this is a configuration matter or Docker environment matter and not a bug within the image, this is probably best handled at the Nextcloud Help Forum.

@MarcS1975
Copy link
Author

MarcS1975 commented Aug 3, 2023

Hi - thank you for your pointers. I was assuming it had something to do with the docker network. The network settings were all correct (as I compared with a mirror server where the stack worked fine). Strangely the problem was caused by a faulty Docker installation, which unfortunately did not log any error messages in Debian or in Docker. But it caused some containers to lack connectivity. Only a fresh docker install solved the issue. After that the stack worked fine without any changes to the stack.

@urbenlegend
Copy link

Not trying to reopen this closed issue, but I just wanted to chime in because this is top in the Google search results for this issue. If anyone is running the Nextcloud docker container in podman and unable to connect to the db, you need to install aardvark-dns. It's what podman uses for DNS resolution between containers.

@shuiyuetianwy
Copy link

like this maybe help you:
version: '3'
services:
mysql:
image: docker.io/mysql:latest
container_name: mysql
restart: always
privileged: true
networks:
- docker-app-net
ports:
- "3306:3306"
- "33060:33060"
volumes:
- /etc/localtime:/etc/localtime
- /data/mysql/mysql-files:/var/lib/mysql-files
- /data/mysql/log:/var/log/mysql
- /data/mysql/data:/var/lib/mysql
- /data/mysql/conf:/etc/mysql
labels:
- aria2 service
environment:
- TZ=Asia/Shanghai
- MYSQL_ROOT_PASSWORD=WY343604ang
command: [
'--skip-host-cache',
'--skip-name-resolve',
'--lower-case-table-names=1',
'--sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION',
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_general_ci',
'--default-authentication-plugin=mysql_native_password'
]

redis:
image: docker.io/redis:latest
container_name: redis
restart: always
privileged: true
networks:
- docker-app-net
ports:
- "6379:6379"
- "16379:16379"
volumes:
- /data/redis/conf/redis.conf:/etc/redis/redis.conf
- /data/redis/data:/data
- /etc/localtime:/etc/localtime
environment:
- TZ=Asia/Shanghai
command: redis-server /etc/redis/redis.conf --requirepass WY343604ang

nginx:
image: docker.io/nginx:latest
container_name: nginx
restart: always
privileged: true
networks:
- docker-app-net
ports:
- "80:80"
volumes:
- /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- /data/nginx/conf.d:/etc/nginx/conf.d
- /data/nginx/html:/usr/share/nginx/html
- /data/nginx/logs:/var/log/nginx
- /etc/localtime:/etc/localtime
environment:
- TZ=Asia/Shanghai

nextcloud:
image: docker.io/nextcloud:latest
container_name: nextcloud
restart: always
privileged: true
networks:
- docker-app-net
ports:
- "18006:80"
volumes:
- /etc/localtime:/etc/localtime
- /data/nextcloud/datas:/var/www/html
environment:
- TZ=Asia/Shanghai
- MYSQL_HOST=192.168.35.21
- MYSQL_DATABASE=nextcloud_db
- MYSQL_USER=root
- MYSQL_PASSWORD=WY343604ang

networks:
docker-app-net:
external: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants