Docker mariadb socket not found

Dear all,

i am using nextcloud with mariadb since 1 1/2 years , since today the nextcloud don’t work any more because it cannot found the socket file anymore, i checked if it exist and it don’t exist, i don’t changed anything in the settings. I restart every day all docker contaienr due to snapraid sync.

cat: /var/run/mysqld/mysqld.pid: No such file or directory

240508 18:12:31 mysqld_safe Logging to ‘/config/databases/e0273e21acd0.err’.

240508 18:12:31 mysqld_safe Starting mariadbd daemon with databases from /config/databases

Caught SIGTERM signal!

Is there a bug or where is the problem that it don’t work any more? Thank all

  • Which image?
  • Post your Compose file

Caught SIGTERM signal!

Are you sure your MariaDB container is running?

This is my compose file . I removed some secret data like url, email and so on

version: "2.2"
services:
  nextcloud:
    image: ghcr.io/linuxserver/nextcloud
    container_name: nextcloud
    environment:
      - PUID=1000 #change PUID if needed
      - PGID=100  #change PGID if needed
      - TZ=Europe/Vienna
    volumes:
      - /srv/mergerfs/mergerHDD/appdata/nextcloud/config:/config
      - /srv/mergerfs/mergerHDD/appdata/nextcloud/data:/data
    depends_on:
      - mariadb
    restart: unless-stopped

  mariadb:
    image: ghcr.io/linuxserver/mariadb
    container_name: nextclouddb
    environment:
      - PUID=1000
      - PGID=100
      - MYSQL_ROOT_PASSWORD=<>
      - TZ=Europe/Vienna
    volumes:
      - /srv/mergerfs/mergerHDD/appdata/nextclouddb:/config
    restart: unless-stopped
  swag:
    image: linuxserver/swag
    container_name: swag
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=1000
      - PGID=100
      - TZ=<>
      - URL=r<>
      - SUBDOMAINS=wildcard
      - VALIDATION=<>
      - DUCKDNSTOKEN=<>
      - EMAIL=<>
    volumes:
      - /srv/mergerfs/mergerHDD/appdata/swag:/config
    ports:
      - 443:443
      - 81:80
    restart: unless-stopped

And this is the output of docker ps. I restart the compose for 5min

ONTAINER ID   IMAGE                                 COMMAND                  CREATED         STATUS                 PORTS                                                                                            NAMES
aedcf014e1ad   ghcr.io/linuxserver/nextcloud         "/init"                  3 minutes ago   Up About a minute      80/tcp, 443/tcp                                                                                  nextcloud
33aa170fafdb   ghcr.io/linuxserver/mariadb           "/init"                  3 minutes ago   Up 2 minutes           3306/tcp                                                                                         nextclouddb
86961d1b4427   linuxserver/swag                      "/init"                  4 hours ago     Up 2 minutes           0.0.0.0:443->443/tcp, :::443->443/tcp, 0.0.0.0:81->80/tcp, :::81->80/tcp                         swag
563f2ee7e8e7   filebrowser/filebrowser:latest        "/filebrowser --port…"   12 months ago   Up 2 hours (healthy)   0.0.0.0:82->80/tcp, :::82->80/tcp                                                                FileBrowser
7b4264cb8058   portainer/portainer-ce                "/portainer"             12 months ago   Up 2 hours             0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp, 9443/tcp   portainer

The funny part is that everthing works since 1 1/2 year and now it don’t work, i don’t change anything since the last restart of the docker container it don’t work anymore

Thank you for helping me

  1. I suggest adding a tag to all your image names to lock things to a particular version. Otherwise you risk upgrading things in ways that will break things (i.e. not all versions of MariaDB are appropriate for production usage nor compatible with Nextcloud).

  2. I suspect your db image either upgraded or maybe got shutdown in a less than ideal way.

e.g. https://www.reddit.com/r/docker/comments/13vipm5/running_mariadb_for_years_all_of_a_sudden/

unfortunately this does not work either i have downgraded to 10.6.13 but i get socket missing again when i want to run the mariadb-check

mariadb-check -u <> -p <> -c
Enter password:
mariadb-check: Got error: 2002: Can’t connect to local server through socket ‘/var/run/mysqld/mysqld.sock’ (2) when trying to connect

I tried to rename the mounted dir that it generates a new one and the error is gone. I copied the database directory into the new one and restarted the container, now the mariadb container seems to be working.

I also looked with mysql show all databases and there are all old ones.

What can be demaging the old directory that the mariadb cannot start.

I have a backup of the raspberry’s sd card where the images are located, but the config directory is on the hard drives, do you mean if I load the backup the system will work again? There are no changes to the config directory, only the new log/error files are new or modified.

You may want to ask on the Linuxserver.io forum (since you seem to be using their images).

Your MariaDB error logs may have some clues.

The lack of socket access was likely just a symptom of the DB itself being offline.

What can be demaging the old directory that the mariadb cannot start.

Well, for one, since your db image version wasn’t tagged you could have been routinely running bleeding edge / non-LTS releases of MariaDB. But I really have no idea. Your MariaDB (and maybe Docker logs) are what you’ll need to look at to reconstruct what’s been going on.