Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secrets not working anymore #581

Closed
MrksHfmn opened this issue Mar 17, 2021 · 1 comment
Closed

Secrets not working anymore #581

MrksHfmn opened this issue Mar 17, 2021 · 1 comment

Comments

@MrksHfmn
Copy link

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)

@tianon
Copy link
Member

tianon commented Mar 17, 2021

We can't reproduce an issue with secrets (beyond the newline issue described in #576 (comment) and fixed in #577), so I'd suggest trying a dedicated support forum, such as the Docker Community Forums, the Docker Community Slack, or Stack Overflow.

@docker-library docker-library locked and limited conversation to collaborators Mar 17, 2021
@docker-library docker-library locked and limited conversation to collaborators Mar 17, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants