Skip to content

Docker Compose with any non-SQLite database fails to connect #119

@Gk2E7Aaojf3KDCQ

Description

@Gk2E7Aaojf3KDCQ

I have tried this a bunch of different ways. I can get the basic SQLite docker compose.yml file to start containers, but the file for starting up a separate container for mysql, postgres, mariadb, all fail. The main php container cannot connect. Docker logs show the php container just continuously attempting to reconnect.

My docker-compose.yml file is the same as recommended, save for mapping 3307:3306 on the database container, as I have a database container for another unreleated Docker app elsewhere. I tried the as-is docker-compose file on another system, with no mysql containers, and got the same problem.

I've read others getting this to work here, what am I doing wrong?

services:
  php:
    image: brufdev/many-notes:latest
    restart: unless-stopped
    environment:
      - APP_URL=http://<local IP address> # address used to access the application
      - DB_CONNECTION=mysql
      - DB_HOST=many-notes-mysql-1
      - DB_PORT=3307
      - DB_DATABASE=manynotes
      - DB_USERNAME=user
      - DB_PASSWORD='<RandomPassword> # mysql user password
    volumes:
      - logs:/var/www/html/storage/logs
      - private:/var/www/html/storage/app/private
      - typesense:/var/www/html/typesense
    ports:
      - 80:8080
    depends_on:
      mysql:
        condition: service_healthy
  mysql:
    image: mysql:9
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=<RootPassword> # mysql root password
      - MYSQL_DATABASE=manynotes
      - MYSQL_USER=user
      - MYSQL_PASSWORD=<RandomPassword> # mysql user password
    volumes:
      - database:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
      interval: 5s
      timeout: 3s
      retries: 2
      start_period: 0s
    ports:
      3307:3306

volumes:
  database:
  logs:
  private:
  typesense:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions