Trouble getting Nextcloud and MariaDB up and running in a podman-pod(1)

Hello Community,

As you could guess from the topic I could use some help to get Nextcloud and MariaDB up and running using a podman-pod(1). But first things first, let me explain what I’m trying to accomplish.

I’m trying to build an ansible role that utilizes the containers.podman collection to deploy a Nextcloud instance and a MariaDB database. Both services should run as containers in a pod (in a rootless podman installation). The ansible role is work in progress. You’ll find it here on GitHub. To build it I’ve used the following documentation:

All neccessary variables should be defined in defaults/main.yml and I thought everyting was ready to deploy a working Nextcloud instance. But the Nextcloud container has an issue to connect to the database. The logs show the following error:

Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory 

In the First use section I’ve found a hint to change the values for MYSQL_DATABASE and MYSQL_HOST to ‘db’. I’ve done that, but now I get the following error instead.

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 failed: Name or service not known

I thought using a pod would enable the Nextcloud container to communicate with the MariaDB contianer via localhost:3306, wouldn’t it?

Does someone have an idea where I made a mistake?

Regards,
Tronde

1 Like

Hello @tronde ,
Just cloned your repo, I’ll try to look things over today.

1 Like

Thanks @jakfrost , any help is much appreciated.

Well, I think I’ve cracked it. I’ve set MYSQL_HOST: 127.0.0.1 instead of MYSQL_HOST: localhost and that seems to do the trick.

I’ve found a hint on reddit. I’ve pushed the fixed version to GitHub with commit f0d2c86. I’ve changed the value of MYSQL_DATABASE as well just for my own convenience.

That’s it. Trouble solved (for now).

1 Like