version: "3.1" services: # Service Name Defined as web postgresDB: # Pull the Image from Repository. image: postgres:latest # Command to use secrects in secrets: # define Secrets name - db_username - db_password environment: # Define environment varaibles POSTGRES_PASSWORD_FILE: /run/secrets/db_password POSTGRES_USER_FILE: /run/secrets/db_username centOS: image: centos deploy: replicas: 1 entrypoint: /bin/sh stdin_open: true tty: true secrets: - source: my-secret secrets: db_username: file: ./postgres_user.txt db_password: file: ./postgres_password.txt my-secret: external: true