Is it possible to commit a container with postgresql running so that it is ready immediately? I have tried using a startup script, CMD and bashrc to start postgresql, which all start it fine when using
docker run -it [containerID]
but it takes approximately 3-5 seconds for postgresql to come up once logged in. I unfortunately need postgresql running on login.
Using this approach...
docker build -t [name]
docker run -it [containerId]
Inside of the container I then run
service postgresql start
and detach with ctrl p + q. Once detached I commit with
docker commit [containerId] [name]
Upon running the new image, postgresql is not running and the lock file is left over. Is it possible to commit a running service like this or is there a way to have postgresql ready upon running the image?