Been using the circleci/postgres:9.6.2-alpine image for running postgres in my CI for our testing suite.
We’re running into an issue where we need multiple databases running locally so we tried setting different ports locally and that worked well, but we can’t get this to work as there doesn’t seem to be a way to set the Port for the circleci/postgres:9.6.2-alpine image.
That might exist, I don’t know. However, if not, consider a custom command to start the server. You’ll essentially have to look up the CMD in circleci/postgres:9.6.2-alpine, or indeed in the image above that.
Once you have that though, you’ll be able to amend it to inject config options in the start-up process, including the port number.
Nice yeah thank you that’s a good alternative. Will go with that if I don’t find anything else. Could probably make my own custom image with the extra config.
This uses the same underlying config as the upstream image there is no way to override the port at this time. Making a custom image is the best approach IMHO because even if you start up postgres to run on a separate port, only 5432 is exposed in the base image so you would have a tough time reaching it.