Skip to content

Commit 6ec4281

Browse files
committed
Swarm stacks using secrets
1 parent 394b5bf commit 6ec4281

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aditya123
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aditya
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# How to use?
2+
- Execute:
3+
```sh
4+
docker stack deploy -c docker-compose.yml adidb
5+
```
6+
7+
# How to remove?
8+
- Execute:
9+
```sh
10+
docker stack rm adidb
11+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: "3.1" # To use 'secrets' in stacks, we must be at least 3.1
2+
3+
services:
4+
psql:
5+
image: postgres
6+
secrets:
7+
- DB_USER
8+
- DB_PASSWORD
9+
environment:
10+
POSTGRES_PASSWORD_FILE: /run/secrets/DB_PASSWORD
11+
POSTGRES_USER_FILE: /run/secrets/DB_USER
12+
13+
secrets:
14+
DB_USER:
15+
file: ./DB_USER.txt
16+
DB_PASSWORD:
17+
file: ./DB_PASSWORD.txt
18+

0 commit comments

Comments
 (0)