Jon Reades - j.reades@ucl.ac.uk
1st October 2025
Search Quay.io for an image:
arm64
images,amd64
Tip
However, in most cases you don’t need to search for these explicitly because ‘builds’ for most images are completed for both.
By default, containers can’t talk to each other for security reasons. We need to join them together in a ‘pod’ to allow this to happen.
This command creates a pod that exposes two ‘ports’ (8888
and 5432
) to the wider world.
Tip
This ‘maps’ port 8888
inside the pod to port 8888
outside the pod, but we could change it to -p 7777:8888
so that requests for 7777
from the outside world are ‘forwarded’ to 8888
inside the pod. That would allow copies of containers to run at the same time in different pods.
There’s a lot going on here that took quite some to figure out1, but the key thing turned out to be the pg_hba.conf
file which tells Postgres on which ports it can use.
podman run --rm -d --name postgres --pod myapp \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=test \
-e POSTGRES_DB=test \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v "${PWD}"/data/postgres:/var/lib/postgresql/data \
-v /tmp:/tmp \
-v "${PWD}"/data/postgres/pg_hba.conf:/var/lib/postgresql/data/pg_hba.conf \
quay.io/taolu/postgis:14-3.5-alpine
Only containers inside the Pod can talk to other containers in the pod. So for the SDS container to talk to PostGIS, they both need to be attached to the pod using myapp
.
You can now connect using your browser: http://localhost:8888/
Tip
The rest of this short tutorial is all run on the SDS container using your browser as the interface. This is true even for bits about the command line interface: in Jupyter you pick File
> New
> Terminal
.
If I haven’t had time to update the SDS container then you can do this on the SDS Terminal in your browser using the folllowing command:
This is because the sqlalchemy
framework is already there but the psycopg2
driver for Postgres isn’t.
Run Python
Now you will start a new Notebook (File
> New
> Notebook
) and create code cells for each of the following sections of code.
Since PostGIS is geospatial and Python can ‘talk’ to PostGIS:
One final thing: if you run a Terminal on your computer (so not in the SDS terminal any more) you can directly query the data.
Tip
The ‘host’ computer is the only other machine that can access the pod.