2

I'm trying to deploy postgres and pgadmin as a swarm stack via docker stack deploy with this compose file

version: '3.7'

services:
  postgres:
    image: postgres
    ports:
      - "5432:5432"
    volumes:
      - postgres-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=87654321
  pgadmin:
    image: dpage/pgadmin4
    ports:
     - "5433:80" 
    environment:
     - [email protected]
     - PGADMIN_DEFAULT_PASSWORD=12345678
    depends_on:
     - postgres 
volumes:
  postgres-data: 

With docker stack deploy - POSTGRES_PASSWORD is never applied to postgres, I can echo env variable inside the container and it contains correct value 87654321 but postgres still uses the default one. However if I use the same compose file with docker-compose everything works fine

1 Answer 1

4

I think the volume postgres-data has already all the data required for postgres.

try to delete it first and re-deploy the stack.

docker-compose down --remove-orphans --volumes

or stop the stack and run:

docker volume rm postgres-data
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.