This is the YAML file with Secrets details:
version: "3.1"
services:
mydb:
image: mysql
ports:
- 3306:3306
volumes:
- my_db:/var/lib/mysql
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=Yes
networks:
- swrm
deploy:
replicas: 3
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 2
window: 120s
volumes:
my_db:
networks:
swrm:
secrets:
username:
file: ./username.txt
password:
file: ./password.txt
I created a stack using this command:
docker stack deploy -c <yml_file> <stack_name>
I can see 2 new secrets getting created once the stak deploy is completed using this command:
[root@ip-172-31-45-243 docker-stack]# docker secret ls
ID NAME CREATED UPDATED
7na4q2z59ffddly3078l78rde testing_username 8 minutes ago 7 minutes ago
vf575nhjmlpn15fauov0dqqda testing_password 8 minutes ago 7 minutes ago
But when I login to the containers started by the stack (using exec
), I am unable to find secrets
folder inside /run
.
Please let me know how to fix this issue.