Bare-metal servers with AMD EPYC™ 9355P processor are available in our UK location. Click here to order.

How to Deploy PocketBase on Ubuntu 26.04 with Docker

  • Published on 2nd Dec 2026

Building a web or mobile application often starts with setting up the backend services that power authentication, data storage, and APIs. Depending on your approach, this can involve configuring several separate components before the application is ready for use.

PocketBase is a lightweight, open-source backend that combines an embedded SQLite database, authentication, REST API, real-time subscriptions, file storage, and an administration dashboard in a single application.

In this tutorial, you will deploy PocketBase on a BaCloud VPS running Ubuntu 26.04 using Docker Compose. You will create a custom Docker image, configure persistent storage, set up Nginx as a reverse proxy, and enable HTTPS with Let's Encrypt.

Prerequisites

Before deploying PocketBase, make sure you have the following:

  • A BaCloud VPS running Ubuntu 26.04.

  • A domain name pointed to your VPS public IP address.

  • SSH access to the server with a user account that has sudo privileges.

  • Basic familiarity with Docker and the Linux command line.

Choose Ubuntu 26.04 VPS hosting in Lithuania, the Netherlands, the USA, or the UK. Fast NVMe storage delivers excellent performance, low latency, and reliable speed for your projects. Perfect for websites, applications, testing environments, and business infrastructure.
Get Ubuntu 26.04 VPS

Step 1: Update the System

Before installing Docker and the required deployment tools, update the package index and upgrade existing packages on your BaCloud VPS to ensure the system has the latest available updates.

Update the package index:

sudo apt update

Once the package index has been updated, upgrade the installed packages:

sudo apt upgrade -y

After the upgrade process completes, the system will be ready for the next deployment steps.

 

Step 2: Install Docker Engine and Docker Compose

Langflow will run as Docker containers, so Docker Engine and Docker Compose must be installed on your BaCloud VPS before continuing.

If Docker is not already installed, follow our How to Install and Set Up Docker on Ubuntu 26.04 guide before continuing.

After Docker installation is complete, verify that Docker Engine is available:

docker --version

img-1796217499-6b101a9b0e6d2.webp

The command should return the installed Docker version.

Next, verify that the Docker Compose plugin is installed:

docker compose version

The command should return the installed Docker Compose version.

If both commands return version information, Docker is installed correctly and your BaCloud VPS is ready to continue with the Langflow deployment.

 

Step 3: Create the PocketBase Project Directory

Create a dedicated directory to store the PocketBase deployment files. This directory will contain the Dockerfile, Docker Compose configuration, and persistent application data.

Create the project directory:

mkdir ~/pocketbase

Next, create the directory that will store PocketBase's persistent data:

mkdir ~/pocketbase/pb_data

Change into the project directory:

cd ~/pocketbase

The PocketBase project directory is now ready, and we can continue by creating the Dockerfile for the custom PocketBase image.

 

Step 4: Create the PocketBase Dockerfile

PocketBase does not provide an official Docker image, so we will create a custom Docker image using the official PocketBase release archive. This allows us to pin a specific version and keep the deployment consistent when rebuilding the container.

Create the Dockerfile:

nano Dockerfile

Add the following configuration:

FROM alpine:latestARG PB_VERSION=0.42.2RUN apk add --no-cache \    unzip \    ca-certificatesADD https://ganigeorgiev.com/meta/pocketbase/pocketbase/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zipRUN unzip /tmp/pb.zip -d /pb/ \    && rm /tmp/pb.zipEXPOSE 8080CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8080"]

This Dockerfile uses Alpine Linux as a lightweight base image, installs the required packages, downloads the pinned PocketBase release, and configures PocketBase to listen on port 8080 inside the container. 

The Dockerfile is now ready, and we can continue by configuring Docker Compose.

 

Step 5: Configure Docker Compose

Docker Compose will define how the PocketBase container is built and managed. In this configuration, we will build the image from the Dockerfile created in the previous step, map PocketBase to a local host port, and store application data outside the container so it remains available after restarts or updates.

Create the Docker Compose file:

nano compose.yaml

Add the following configuration:

services:  pocketbase:    build:      context: .    container_name: pocketbase    ports:      - "127.0.0.1:8080:8080"    volumes:      - ./pb_data:/pb/pb_data    restart: unless-stopped

This configuration builds the PocketBase image from the local Dockerfile, creates a container named pocketbase, and exposes the application only on the local server interface. The pb_data directory is mounted as persistent storage, allowing PocketBase data to remain available when the container is recreated.

The Docker Compose configuration is now ready, and we can continue by building the image and starting the PocketBase container.

 

Step 6: Build and Start PocketBase

With the Dockerfile and Docker Compose configuration in place, build the PocketBase image and start the container.

Build the custom PocketBase Docker image:

docker compose build

After the image has been built successfully, start the PocketBase container in detached mode:

docker compose up -d

Verify that the PocketBase container is running:

docker ps

You should see the pocketbase container listed with a running status.

The PocketBase container is now running, and we can continue by configuring Nginx as a reverse proxy to make the application accessible through your domain.

 

Step 7: Configure Nginx as a Reverse Proxy

PocketBase is currently running on the local server port 8080. To make it accessible through your domain, configure Nginx as a reverse proxy that forwards incoming requests to the PocketBase container.

If Nginx is not already installed, install it:

sudo apt install nginx -y

Create a new Nginx server block for your PocketBase domain:

sudo nano /etc/nginx/sites-available/pocketbase

Add the following configuration:

server {    listen 80;    server_name your-domain.com;    client_max_body_size 50M;    location / {        proxy_pass http://127.0.0.1:8080;        proxy_set_header Host $host;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        proxy_set_header X-Forwarded-Proto $scheme;        proxy_http_version 1.1;        proxy_set_header Upgrade $http_upgrade;        proxy_set_header Connection "upgrade";        proxy_read_timeout 300s;    }}

Replace your-domain.com with your actual PocketBase domain.

Enable the Nginx configuration:

sudo ln -s /etc/nginx/sites-available/pocketbase /etc/nginx/sites-enabled/

Test the Nginx configuration:

sudo nginx -t

If the configuration test is successful, reload Nginx to apply the changes:

sudo systemctl reload nginx

Nginx is now forwarding requests from your domain to the PocketBase container, including support for WebSocket connections used by PocketBase real-time subscriptions.

 

Step 8: Enable HTTPS with Let's Encrypt

Securing your PocketBase deployment with HTTPS protects data transmitted between clients and the server. In this step, we will use Certbot to obtain and configure a free SSL certificate from Let's Encrypt.

If Certbot is not already installed, install it along with the Nginx plugin:

sudo apt install certbot python3-certbot-nginx -y

After the installation is complete, request and install an SSL certificate for your domain:

sudo certbot --nginx -d your-domain.com

Replace your-domain.com with the domain you configured for PocketBase.

Follow the prompts to provide an email address, accept the Let's Encrypt terms of service, and choose whether to redirect all HTTP traffic to HTTPS. Select the option to redirect traffic so all requests are automatically secured.

Once Certbot finishes successfully, verify that your PocketBase deployment is accessible over HTTPS by opening:

https://your-domain.com/_/

img-1796217499-6b101a9b10bc4.webp

If the page loads without certificate warnings and the connection is shown as secure in your browser, HTTPS has been configured successfully.

With HTTPS enabled, your PocketBase deployment is now securely accessible, and we can create the initial administrator account.

 

Step 9: Create the Initial Superuser Account

After confirming that HTTPS is working, complete the initial PocketBase setup by creating the first superuser account.

When PocketBase starts without an existing superuser account, it generates a one-time installation URL. Retrieve this URL from the container logs:

docker compose logs pocketbase

Look for the message containing:

Launch the URL below in the browser if it hasn't been open already to create your first superuser account:

The generated URL will look similar to:

http://0.0.0.0:8080/_/#/pbinstall/TEMPORARY_INSTALL_TOKEN

Copy the complete URL from your terminal output and replace only the local address with your public domain:

https://your-domain.com/_/#/pbinstall/TEMPORARY_INSTALL_TOKEN

Keep the installation token unchanged when updating the URL.

Open the updated URL in your browser and complete the form to create your first PocketBase superuser account.

img-1796217499-6b101a9b2da43.webp

After you create the account, PocketBase automatically redirects you to the administration dashboard. 

img-1796217499-6b101a9b46b02.webp

Your PocketBase deployment is now ready to use.

Conclusion

You have successfully deployed PocketBase on Ubuntu 26.04 using Docker, secured it with Nginx and Let's Encrypt, and completed the initial superuser setup. Your PocketBase instance is now ready to serve as a secure backend with persistent data storage.

Before making future changes to your deployment, back up the pb_data directory to protect your application data.

For more in-depth tutorials, visit the BaCloud blog, where you’ll find helpful guides.

« Back