dockernextcloud

nextcloud container has no access to datase


I use nextcloud with mariadb in docker container under Portainer. I just updated both, but now the Nextcloud container has no more access to the database. Wether over the IP nor over the alias.

Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Host is unreachable

what make me nuts is, I can access the Database in the same network over an phpmyadmin Container. So the local IP is correct. But I can't ping from the nextcloud to the mariadb Container.

Since I use Portainer I thought everything is easy and the Network with the name "nextcloud_default" is shown at all three Container I use. But what can do if this failed?


Solution

  • I had the exact same problem.

    The problem is that the two container (nextcloud and nextcloud_db) have the same MAC address: 02:42:ac:17:00:02. The cause of this issue is Portainer, not docker, nor nextcloud or mariadb.

    You can read more about MAC address collisions in these github issues:

    The solution for me was to manually assign MAC addresses to the containers.