<p>Regarding the documentation in <a href="https://hub.docker.com/_/mariadb?tab=description" rel="nofollow noreferrer">https://hub.docker.com/_/mariadb?tab=description</a>, your solution can be this:</p>
<pre><code>version: &quot;3.9&quot;

services:

  db:
    image: mariadb:10.7
    secrets:
      - rootpass
      - dbpass
      - mysqldb
      - mysqluser
    environment:
      MARIADB_ROOT_PASSWORD_FILE: /run/secrets/rootpass
      MARIADB_DATABASE_FILE: /run/secrets/mysqldb
      MARIADB_USER_FILE: /run/secrets/mysqluser
      MARIADB_PASSWORD_FILE: /run/secrets/dbpass
    restart: unless-stopped
    ports:
      - '3306:3306'

secrets:
  rootpass:
    file: ./cf/root_pass
  dbpass:
    file: ./cf/db_pass
  mysqldb:
    file: ./cf/mysql_db
  mysqluser:
    file: ./cf/mysql_user
</code></pre>

CC BY-SA 4.0
2023-06-25T11:58:25.557Z
In your solution, the secrets are in some files beside the `docker-compose.yaml` file, which are plain text. So, who to use that plain text as encrypted in `docker-compose` without `swarm`?
shgnInc
CC BY-SA 4.0
2022-06-14T14:25:18.373Z
2023-01-05T12:33:00.967Z
2023-01-05T12:33:00.967Z
britodfbr
<p>I am using Docker, but not Swarm (or any other orchestration) for a project.</p>
<p>Is there a way to leverage Docker Secrets without Swarm?</p>

<docker><secret-management>
Secrets in Docker without Swarm
a20z
# Secrets in Docker without Swarm

(Asked by: username_0 on 2020-07-30)

I am using Docker, but not Swarm (or any other orchestration) for a project.

Is there a way to leverage Docker Secrets without Swarm?

**Tags:** docker, secret-management


---

## 1 answers

### Answer by username_1 on 2022-06-14. Score: 0

Regarding the documentation in https://hub.docker.com/_/mariadb?tab=description, your solution can be this:
version: "3.9"

services:

  db:
    image: mariadb:10.7
    secrets:
      - rootpass
      - dbpass
      - mysqldb
      - mysqluser
    environment:
      MARIADB_ROOT_PASSWORD_FILE: /run/secrets/rootpass
      MARIADB_DATABASE_FILE: /run/secrets/mysqldb
      MARIADB_USER_FILE: /run/secrets/mysqluser
      MARIADB_PASSWORD_FILE: /run/secrets/dbpass
    restart: unless-stopped
    ports:
      - '3306:3306'

secrets:
  rootpass:
    file: ./cf/root_pass
  dbpass:
    file: ./cf/db_pass
  mysqldb:
    file: ./cf/mysql_db
  mysqluser:
    file: ./cf/mysql_user

> **Comments:**
> **username_2**: In your solution, the secrets are in some files beside the `docker-compose.yaml` file, which are plain text. So, who to use that plain text as encrypted in `docker-compose` without `swarm`?  

---

