Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

428
Vistas
Wordpress not connecting to database with nginx, letsencrypt, and docker compose

I have a VPS setup with debian 10 and looking to add multiple wqordpress sites using docker compose. I am using nginx and letsencrypt in separate containers...and that part seems to be working. I get the SSL and can ping the site, WP wont connect to the database though and I have a feeling I am missing something simple...I'm a newb with docker and compose

here is my docker-compose.yml file

version: "3"

services:
   db_domain:
     image: mysql:5.7
     volumes:
        - db_data:/var/lib/mysql
     restart: always
     environment:
        MYSQL_ROOT_PASSWORD: Password1234
        MYSQL_DATABASE: domain-db
        MYSQL_USER: domainUser
        MYSQL_PASSWORD: otherPassword1234
     container_name: domain-db

   wordpress:
     depends_on:
        - db_domain
     image: wordpress:latest
     expose:
        - 80
     restart: always
     environment:
        VIRTUAL_HOST: domain.com
        LETSENCRYPT_HOST: domain.com
        LETSENCRYPT_EMAIL: admin@domain.com
        WORDPRESS_DB_HOST: db_domain:3306
        WORDPRESS_DB_USER: domainUser
        WORDPRESS_DB_PASSWORD: otherPassword1234
     container_name: domain-wp
volumes:
  db_data:

networks:
  default:
    external:
      name: nginx-proxy
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You have a couple of issues: The environment variables for the Mysql service are not setup properly and the Wordpress service is missing the WORDPRESS_DB_NAME: domain-db environment variable. Here is a configuration that comes up without DB errors:

version: "3"

services:
   db_domain:
     image: mysql:5.7
     volumes:
        - db_data:/var/lib/mysql
     restart: always
     environment:
        - MYSQL_ROOT_PASSWORD=Password1234
        - MYSQL_DATABASE=domain-db
        - MYSQL_USER=domainUser
        - MYSQL_PASSWORD=otherPassword1234
     container_name: domain-db
     ports:
       - "3306:3306"
   wordpress:
     depends_on:
        - db_domain
     image: wordpress:latest
     expose:
        - 80
     restart: always
     environment:
        VIRTUAL_HOST: domain.com
        LETSENCRYPT_HOST: domain.com
        LETSENCRYPT_EMAIL: admin@domain.com
        WORDPRESS_DB_HOST: db_domain:3306
        WORDPRESS_DB_USER: domainUser
        WORDPRESS_DB_PASSWORD: otherPassword1234
        WORDPRESS_DB_NAME: domain-db
     container_name: domain-wp
volumes:
  db_data:
over 4 years ago · Santiago Trujillo Denunciar

0

You have to add this WORDPRESS_DB_NAME: domain-db.

And the WORDPRESS_DB_PASSWORD must to be equal to MYSQL_PASSWORD.

Anyway, RTFM -> https://hub.docker.com/_/wordpress/

Best regards.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda