Skip to content

[Bug] Error Due to Missing 'cache_locks' Table in MariaDB #11

@homelab-alpha

Description

@homelab-alpha

Hi alexjustesen,

In your comment, you mentioned that you are also building your own images. 👍
That made me curious, so I tried testing the images with MariaDB.

Unfortunately, I consistently run into the following error: Table 'speedtest-tracker_db.cache_locks' doesn't exist.

As you mentioned yourself: “⚠️ use my image at your own risk, still ironing it out should you choose to switch.”

This issue is not intended to resolve the problem as quickly as possible; I only want to make you aware of it. Please feel free to take your time.

Below, you can find the compose, env, and log files.

Compose file (click to expand)

---
networks:
  speedtest-tracker_net:
    attachable: false
    internal: false
    external: false
    name: speedtest-tracker
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 172.21.23.0/24
          ip_range: 172.21.23.0/24
          gateway: 172.21.23.1
    driver_opts:
      com.docker.network.bridge.default_bridge: "false"
      com.docker.network.bridge.enable_icc: "true"
      com.docker.network.bridge.enable_ip_masquerade: "true"
      com.docker.network.bridge.host_binding_ipv4: "0.0.0.0"
      com.docker.network.bridge.name: "speedtest"
      com.docker.network.driver.mtu: "1500"
    labels:
      com.speedtest-tracker.network.description:
        "is an isolated bridge network."

services:
  speedtest-tracker_db:
    restart: unless-stopped
    logging:
      driver: "json-file"
      options:
        max-size: "1M"
        max-file: "2"
    stop_grace_period: 1m
    container_name: speedtest-tracker_db
    image: docker.io/mariadb:latest
    pull_policy: if_not_present
    volumes:
      - /docker/speedtest-tracker/production/db:/var/lib/mysql
    env_file:
      - .env
    environment:
      PUID: "1000"
      PGID: "1000"
      TZ: Europe/Amsterdam
      MARIADB_ROOT_PASSWORD: ${ROOT_PASSWORD_DB}
      MARIADB_DATABASE: ${NAME_DB}
      MARIADB_USER: ${USER_DB}
      MARIADB_PASSWORD: ${PASSWORD_DB}
    hostname: speedtest-tracker_db
    networks:
      speedtest-tracker_net:
        ipv4_address: 172.21.23.2
    security_opt:
      - no-new-privileges:true
    labels:
      com.speedtest-tracker.db.description: "is a MariaDB database."
    healthcheck:
      disable: false
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 10s
      start_interval: 5s

  speedtest-tracker_app:
    restart: unless-stopped
    logging:
      driver: "json-file"
      options:
        max-size: "1M"
        max-file: "2"
    stop_grace_period: 1m
    container_name: speedtest-tracker
    image: ghcr.io/alexjustesen/docker-speedtest-tracker:latest
    pull_policy: if_not_present
    depends_on:
      speedtest-tracker_db:
        condition: service_healthy
        restart: true
    links:
      - speedtest-tracker_db
    volumes:
      - /docker/speedtest-tracker/production/.cert:/config/keys
      - /docker/speedtest-tracker/production/app:/config
    env_file:
      - .env
    environment:
      PUID: "1000"
      PGID: "1000"
      TZ: Europe/Amsterdam
      APP_DEBUG: true
      DB_CONNECTION: mysql
      DB_HOST: ${HOST_DB}
      DB_PORT: ${PORT_DB}
      DB_DATABASE: ${NAME_DB}
      DB_USERNAME: ${USER_DB}
      DB_PASSWORD: ${PASSWORD_DB}
      APP_KEY: ${APP_KEY}
      APP_URL: http://localhost
      ADMIN_NAME: ${ADMIN_NAME}
      ADMIN_EMAIL: ${ADMIN_EMAIL}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
    domainname: http://localhost
    hostname: localhost
    networks:
      speedtest-tracker_net:
        ipv4_address: 172.21.23.3
    ports:
      - "80:8080/tcp"
      - "80:8080/udp"
    security_opt:
      - no-new-privileges:true
    labels:
      com.docker.compose.project: "speedtest-tracker"
      com.speedtest-tracker.description:
        "a self-hosted application that monitors the performance and uptime of
        your internet connection."
    healthcheck:
      disable: false
      test: curl -fSs APP_URL/api/healthcheck | jq -r .message || exit 1
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 10s
      start_interval: 5s

ENV file (click to expand)

# Database Configuration: ROOT USER
# Change the MariaDB root password to a strong, unique password of your choice.
# Ensure the password is complex and not easily guessable.
ROOT_PASSWORD_DB=StrongUniqueRootPassword1234

# Database Configuration: USER
# Database host and connection settings
HOST_DB=speedtest-tracker_db

# Database name: Change this to your desired database name
NAME_DB=speedtest_tracker_db

# MariaDB user password: Change this to a strong, unique password
PASSWORD_DB=StrongUniqueUserPassword5678

# MariaDB connection port (default: 3306)
PORT_DB=3306

# MariaDB username: Change this to your desired username
USER_DB=speedtest-tracker

# Application Key
# Define a secure application key for encryption.
# To generate a new secure key, run the following in the terminal:
#
#   echo -n 'base64:'; openssl rand -base64 32
#
# This will output a base64 encoded key.
# Example output: base64:BehUUH9rR5A+DDVqJDJLrj31X13asZ8YNNt9J+dauGg=
APP_KEY=base64:BehUUH9rR5A+DDVqJDJLrj31X13asZ8YNNt9J+dauGg=

# Admin Credentials for Dashboard Access
# Choose strong and unique credentials for admin access to the application dashboard.
# Avoid using default usernames and passwords in production.
ADMIN_EMAIL=[email protected]
ADMIN_NAME=admin
ADMIN_PASSWORD=StrongUniqueUserPassword9012

Log file (click to expand)

Container started

ℹ️ NOTICE (generate-ssl): SSL mode is off, so we won't generate a self-signed SSL key pair.
ℹ️ NOTICE (init-webserver-config): /etc/nginx/nginx.conf already exists, so we'll use the existing file.
ℹ️ NOTICE (init-webserver-config): /etc/nginx/site-opts.d/http.conf already exists, so we'll use the existing file.
ℹ️ NOTICE (init-webserver-config): /etc/nginx/site-opts.d/https.conf already exists, so we'll use the existing file.
ℹ️ NOTICE (init-webserver-config): /etc/nginx/sites-available/ssl-full already exists, so we'll use the existing file.
ℹ️ NOTICE (init-webserver-config): /etc/nginx/conf.d/default.conf already exists, so we'll use the provided configuration.

🤔 Checking for Laravel automations...
✅ Storage already linked...
🚀 Clearing Laravel cache before attempting migrations...

INFO  Configuration cache cleared successfully.

⚡️ Attempting connection to default database...
✅ Database connection successful

production.ERROR: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'speedtest-tracker_db.cache_locks' doesn't
exist (Connection: mysql, SQL: update `cache_locks` set `owner` = LX4hpfUfZDJu3Msu, `expiration` = 1765957500 where
`key` = laravel_cache_framework/command-migrate and (`owner` = LX4hpfUfZDJu3Msu or `expiration` <= 1765953900))
{"exception":"[object] (Illuminate\\Database\\QueryException(code: 42S02): SQLSTATE[42S02]: Base table or view not
found: 1146 Table 'speedtest-tracker_db.cache_locks' doesn't exist (Connection: mysql, SQL: update `cache_locks` set
`owner` = LX4hpfUfZDJu3Msu, `expiration` = 1765957500 where `key` = laravel_cache_framework/command-migrate and (`owner`
= LX4hpfUfZDJu3Msu or `expiration` <= 1765953900)) at
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:826)

[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(780): Illuminate\\Database\\Connection->runQueryCallback()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(583): Illuminate\\Database\\Connection->run()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(535): Illuminate\\Database\\Connection->affectingStatement()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3917): Illuminate\\Database\\Connection->update()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/DatabaseLock.php(79): Illuminate\\Database\\Query\\Builder->update()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Lock.php(90): Illuminate\\Cache\\DatabaseLock->acquire()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/CacheCommandMutex.php(57): Illuminate\\Cache\\Lock->get()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(198): Illuminate\\Console\\CacheCommandMutex->create()
#8 /var/www/html/vendor/symfony/console/Command/Command.php(335): Illuminate\\Console\\Command->execute()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#10 /var/www/html/vendor/symfony/console/Application.php(1103): Illuminate\\Console\\Command->run()
#11 /var/www/html/vendor/symfony/console/Application.php(356): Symfony\\Component\\Console\\Application->doRunCommand()
#12 /var/www/html/vendor/symfony/console/Application.php(195): Symfony\\Component\\Console\\Application->doRun()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(197): Symfony\\Component\\Console\\Application->run()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1235): Illuminate\\Foundation\\Console\\Kernel->handle()
#15 /var/www/html/artisan(16): Illuminate\\Foundation\\Application->handleCommand()
#16 {main}

[previous exception] [object] (PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table
'speedtest-tracker_db.cache_locks' doesn't exist at
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:591)

[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(591): PDO->prepare()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(813): Illuminate\\Database\\Connection->{closure:Illuminate\\Database\\Connection::affectingStatement():583}()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(780): Illuminate\\Database\\Connection->runQueryCallback()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(583): Illuminate\\Database\\Connection->run()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(535): Illuminate\\Database\\Connection->affectingStatement()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3917): Illuminate\\Database\\Connection->update()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/DatabaseLock.php(79): Illuminate\\Database\\Query\\Builder->update()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Lock.php(90): Illuminate\\Cache\\DatabaseLock->acquire()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/CacheCommandMutex.php(57): Illuminate\\Cache\\Lock->get()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(198): Illuminate\\Console\\CacheCommandMutex->create()
#10 /var/www/html/vendor/symfony/console/Command/Command.php(335): Illuminate\\Console\\Command->execute()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#12 /var/www/html/vendor/symfony/console/Application.php(1103): Illuminate\\Console\\Command->run()
#13 /var/www/html/vendor/symfony/console/Application.php(356): Symfony\\Component\\Console\\Application->doRunCommand()
#14 /var/www/html/vendor/symfony/console/Application.php(195): Symfony\\Component\\Console\\Application->doRun()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(197): Symfony\\Component\\Console\\Application->run()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1235): Illuminate\\Foundation\\Console\\Kernel->handle()
#17 /var/www/html/artisan(16): Illuminate\\Foundation\\Application->handleCommand()
#18 {main}
"}

In Connection.php line 826:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'speedtest-tracker_db.cache_locks' doesn't exist (Connection:
  mysql, SQL: update `cache_lock s` set `owner` = LX4hpfUfZDJu3Msu, `expiration` = 1765957500 where `key` =
  laravel_cache_framework/command-migrate and (`owner` = LX4hpfUfZDJu3Msu or `expiration` <= 1765953900))

In Connection.php line 591:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'speedtest-tracker_db.cache_locks' doesn't exist

Container stopped


Note

The container will repeatedly start and stop, showing the same log message each time.

Edit:

  • Fix typo: .env --> From: NAME_DB=speedtest-tracker_db to: NAME_DB=speedtest_tracker_db

Metadata

Metadata

Assignees

Labels

🐛 bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions