Fly.io: Run PocketBase on fly.io

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


First set up fly.io. See run an app on fly.io.

Create an empty folder, add this Dockerfile (update the PB_VERSION value to the latest version of PocketBase available):

FROM ubuntu:latest

ARG PB_VERSION=0.20.4

RUN apk add --no-cache \
    unzip \
    ca-certificates

# download and unzip PocketBase
ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zip

RUN unzip /tmp/pb.zip -d /pb/

# uncomment to copy the local pb_migrations dir into the image
# COPY ./pb_migrations /pb/pb_migrations

# uncomment to copy the local pb_hooks dir into the image
# COPY ./pb_hooks /pb/pb_hooks

EXPOSE 8080

# start PocketBase
CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8080"]

Run fly launch --build-only to create and build the app but not deploy it, as we need to attach a volume to persist data across deploys (but first we need to initialize it and the fly.toml file)

Run fly volumes create pb_data --size=1 to create the volume. Create it in the same region of the app

Now in fly.toml add:

[mounts]
  destination = "/pb/pb_data"
  source = "pb_data"

Now run fly deploy --ha=false

Pocketbase will be available at https://<yourapp>.fly.dev/_/

Only problem I had was internal connection URLs (.internal) in Fly, I haven’t found a way to make both IPv4 (used for external connection) work alongside IPv6 (used for internal connections), so in my app (also in Fly) I used external URL (hope to fix).

Lessons in this unit:

0: Introduction
1: Run an app on fly.io
2: Deployment strategy on fly.io
3: ▶︎ Run PocketBase on fly.io
4: Deploy to Fly via GitHub action
5: Fly.io, list all regions available