Install Pocketbase with Docker and Docker Compose
Here is a simple docker-compose.yml
file to set up PocketBase:
version: '3.8'
services:
pocketbase:
image: pocketbase/pocketbase:latest
container_name: pocketbase
volumes:
- ./pb_data:/pb_data
ports:
- "8090:8090"
command: ["serve", "--http=0.0.0.0:8090", "--dir=/pb_data"]
restart: unless-stopped
volumes:
pb_data:
Explanation
- pocketbase: The service running the PocketBase application.
- image: The official PocketBase Docker image.
- container_name: Name of the container.
- volumes: Maps the local directory
./pb_data
to/pb_data
inside the container for persistent data storage. - ports: Maps the container's port 8090 to your host machine's port 8090.
- command: Runs PocketBase with the HTTP server listening on all interfaces (
0.0.0.0
) and specifies the data directory. - restart: Ensures that the container restarts automatically unless stopped manually.
Running the Setup
Access PocketBase: Open your browser and go to http://localhost:8090
to access PocketBase.
Stop the container:
docker-compose down
Start the container:
docker-compose up -d
This configuration allows you to quickly deploy PocketBase with Docker Compose.