Skip to content

Secrets not working anymore #581

Closed
Closed
@MrksHfmn

Description

@MrksHfmn

The content auf my secrets are not transferred into to the container. i can login to the database within the container using the 'mysql -u user -p' command. The secret files have no new lines, as mentioned in other issues.

Not working:

 - WORDPRESS_DB_PASSWORD_FILE=/run/secrets/wordpress_blog_db_user_password

working:

 - WORDPRESS_DB_PASSWORD=MyPasswordFromTheSecretFile

here is my complete compose file:

---
version: '3.8'

services:
  wordpress-blog-db:
    image: mariadb
    container_name: wordpress-blog-db
    command: --transaction-isolation=READ-COMMITTED --log-bin=ROW
    restart: unless-stopped
    volumes:
      - /opt/docker/wordpress-blog/db:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD_FILE: /run/secrets/wordpress_blog_db_root_password
      MYSQL_PASSWORD_FILE: /run/secrets/wordpress_blog_db_user_password
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_INITDB_SKIP_TZINFO: 1
    secrets:
      - wordpress_blog_db_root_password
      - wordpress_blog_db_user_password
    networks:
      - wordpress-blog


  wordpress-blog:
    image: wordpress:latest
    container_name: wordpress-blog
    restart: unless-stopped
    depends_on:
      - wordpress-blog-db
    volumes:
      - /opt/docker/wordpress-blog/data/wp-content:/var/www/html/wp-content
    environment:
      - WORDPRESS_DB_HOST=wordpress-blog-db:3306
      - WORDPRESS_DB_USER=wordpress
      - WORDPRESS_DB_PASSWORD_FILE=/run/secrets/wordpress_blog_db_user_password
      - WORDPRESS_DB_NAME=wordpress
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      - "traefik.http.middlewares.wordpress-blog-https.redirectscheme.scheme=https"
      - "traefik.http.routers.wordpress-blog-http.entrypoints=http"
      - "traefik.http.routers.wordpress-blog-http.rule=Host(`www.blog-test.de`)"
      - "traefik.http.routers.wordpress-blog-http.middlewares=wordpress-blog-https@docker"
      - "traefik.http.routers.wordpress-blog.entrypoints=https"
      - "traefik.http.routers.wordpress-blog.rule=Host(`www.blog-test.de`)"
      - "traefik.http.routers.wordpress-blog.tls=true"
      - "traefik.http.routers.wordpress-blog.tls.certresolver=http"
      - "traefik.http.routers.wordpress-blog.middlewares=secHeaders@file"
      - "traefik.http.services.wordpress-blog.loadbalancer.server.port=80"
    networks:
      - wordpress-blog
      - traefik
    secrets:
      - wordpress_blog_db_user_password

secrets:
  wordpress_blog_db_root_password:
    file: /opt/docker/_secrets/wordpress_blog_db_root_password
  wordpress_blog_db_user_password:
    file: /opt/docker/_secrets/wordpress_blog_db_user_password

networks:
  traefik:
    external: true
  wordpress-blog:
    external: true

Originally posted by @MrksHfmn in #578 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions