How to use a custom database image

Is there a way to choose a different image for the database? I still want to use Postgres but I want this one:


Is there away to specify that one instead of the default one for Postgres?


You may still want to use your custom image, but note that the Fly Postgres image (14.4) includes PostGIS.

I don’t think it does. When I ran my migrations to enable PostGIS it crash and could not recognize it. Is there any place where I can see what is there?

It’s definitely included; I’m running a PostGIS db using the stock Fly application. Your migration probably won’t create the extension as part of its run. Instead, Log into your db and run CREATE EXTENSION postgis;

If that works you can enable the other PostGIS extensions you need (raster, topology, sfcgal): Installation | PostGIS in the same way.

Hello, @narven! Fly Postgres runs as a Fly app with this image: flyio/postgres on Docker Hub

You can dig into the source to see what’s in the image: GitHub - fly-apps/postgres-ha: Postgres + Stolon for HA clusters as Fly apps. It includes a lot of goodies, particularly Stolon, HAProxy and custom code to make clustering work on (and to provide health checks and admin tools for the cluster).

You can fork this repo, customize it, and deploy your own cluster on the Fly platform–you’ll keep a lot of the built-in goodies, but you’ll lose the easy administration using fly postgres commands that rely on the version metadata from Docker Hub.

As @shugel says, PostGIS is included in the Fly image.

Thanks @shugel @catflydotio , I will investigate that today. If it comes with it, the default is fine :slight_smile:

Thanks @shugel.

What you mention is correct.


fly postgres connect -a myapp

and then running \dx only plpgsql was enabled.


SELECT * FROM pg_available_extensions;

showed all available. and running:



Also one thing to mention, that happen in my case. when I was running this last command, PG crashed several times. the main cause was lack of memory, I was running with 248MB. after scaling to 1024, it worked.

fly machine update <app_id> --memory 1024 --app <app_name>
1 Like