When I use the postgres docker image, I run
docker run --name mydb -e POSTGRES_PASSWORD=password -d postgres
And I see a container running.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a36b98h8982a postgres "docker-entrypoint.sā¦" 36 minutes ago Up 36 minutes 5432/tcp mydb
So I make my Dockerfile because I want to initialize my database
FROM postgres:latest
COPY pg-setup.sql /docker-entrypoint-initdb.d/
CMD ['postgres']
But when I use the Dockerfile the container just exits immediately. How do I get it to run like the postgres image?