version: '3.8' volumes: db_storage: n8n_storage: services: postgres: image: postgres:11 restart: always environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=verysecret - POSTGRES_DB=n8n - POSTGRES_NON_ROOT_USER=n8n - POSTGRES_NON_ROOT_PASSWORD=verysecret volumes: - db_storage:/var/lib/postgresql/data - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh healthcheck: test: ['CMD-SHELL', 'pg_isready -h localhost -U postgres -d n8n'] interval: 5s timeout: 5s retries: 10 n8n: image: docker.n8n.io/n8nio/n8n restart: always environment: - DB_TYPE=postgresdb - DB_POSTGRESDB_HOST=postgres - DB_POSTGRESDB_PORT=5432 - DB_POSTGRESDB_DATABASE=n8n - DB_POSTGRESDB_USER=postgres - DB_POSTGRESDB_PASSWORD=verysecret - N8N_EDITOR_BASE_URL=http://server1.local:5678 - N8N_SECURE_COOKIE=false ports: - 5678:5678 links: - postgres volumes: - n8n_storage:/home/node/.n8n depends_on: postgres: condition: service_healthy