'How to run init script manually in docker-compose?
I have a Windows container on Windows Server 2019 and I am spinning up a PostgreSQL container. I placed my initdb.sql file inside the docker-entrypoint-initdb.d folder, but it does not work on Windows Server 2019 (works on all other machines, Windows 10, Ubuntu, MacOS, and I have converted it to a Windows container on windows for testing as well).
So now, I want to manually run the initdb.sql script inside my docker-compose. I am wondering what the command would be to manually run the initdb.sql script.
My docker compose is:
version: "3"
networks:
localnetwork:
services:
postgres_db:
image: stellirin/postgres-windows:12-1809
restart: unless-stopped
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
volumes:
- .\admin\${ENV:-dev}\dbms\init:C:\docker-entrypoint-initdb.d
command: <command to run my initdb.sql>
ports:
- "5432:5432"
networks:
- localnetwork
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
