docker-compose secrets without swarm
Ok, so all I had to do is to remove
volumes: - ./postgres:/var/lib/postgresql/data
I'll try to figure out how to fix it, but essentially I answered my own question.
Here is a working example of docker-compose.yml
file with secrets without using docker swarm:
version: '3.1'services: postgres: image: postgres:9.4 container_name: postgres environment: POSTGRES_USER: "db_user" POSTGRES_PASSWORD_FILE: /run/secrets/db_password POSTGRES_DB: "my_db" secrets: - db_password ports: - "8888:5432"secrets: db_password: file: ./POSTGRES_PASSWORD