Docker Deployment
Pigsty runs on native Linux. It can also run in Linux containers with systemd. If you use macOS or Windows, use Docker to try a local single-node installation.
Quick Start
Enter the docker/ source directory.
Run the launch command:
After deployment, use these addresses and commands to connect:
| Service | URL / Command | Credentials |
|---|---|---|
| SSH | ssh root@localhost -p 2222 | Password: pigsty |
| Web Portal | http://localhost:8080 | - |
| Grafana | http://localhost:8080/ui | admin / grafana_admin_password |
| PostgreSQL | psql 'postgres://dbuser_dba:<pg_admin_password>@localhost:5432/postgres' | pg_admin_password |
The make launch command runs ./configure -g to generate random passwords.
Use this command to find the generated passwords:
The Web Portal and PostgreSQL become available after ./deploy.yml completes successfully.
Prepare
Make sure that the host meets these requirements:
| Item | Requirement | Item | Requirement |
|---|---|---|---|
| Docker | Docker 20.10+ (Desktop or CE) | CPU | At least 1 core |
| RAM | At least 2GB | Disk | At least 20GB free |
Make sure that host ports 2222, 8080, 8443, and 5432 are available.
If a port is in use, change its mapping in .env before launch.
- Try Pigsty on macOS or Windows.
- Learn, test, develop, or debug Pigsty features.
- Run a local PostgreSQL development environment.
This single-node container does not provide high availability across multiple nodes. For production or large deployments, use native Linux virtual machines or physical servers. Native Linux avoids the container and virtualization overhead of this testing environment.
Image
Pigsty supplies the pgsty/pigsty image on Docker Hub.
| Image | Pull | Size | Contents |
|---|---|---|---|
pgsty/pigsty | ~500MB | 1.3GB | Debian 13 + systemd + SSH + pig + Ansible |
The image supports amd64 (x86_64) and arm64.
The ARM architecture includes Apple Silicon and AWS Graviton.
Image tags follow Pigsty versions.
The latest and v4.5.0 tags point to the current release.
Select a version tag for repeatable deployment.
The image uses Debian 13 (Trixie).
It includes systemd, SSH, the pig command-line tool, Ansible, and initialized Pigsty source.
The Docker configuration template prepares it for ./deploy.yml.
Launch
Use the commands in the docker/ directory.
The make launch command starts the container, generates its configuration, and runs deployment:
To examine each stage separately, run the commands in this order:
To build the image locally, use these commands:
Config
Set the image version and port mappings in .env:
The port variables map host ports to container ports:
| Env Var | Default | Container | Description |
|---|---|---|---|
PIGSTY_VERSION | v4.5.0 | - | Current main source default; verify the remote tag separately |
PIGSTY_SSH_PORT | 2222 | 22 | SSH access port |
PIGSTY_HTTP_PORT | 8080 | 80 | Nginx HTTP port |
PIGSTY_HTTPS_PORT | 8443 | 443 | Nginx HTTPS port |
PIGSTY_PG_PORT | 5432 | 5432 | PostgreSQL port |
If a default host port is in use, supply a different value through an environment variable:
Commands
The Docker Makefile supplies commands to manage containers and images. Run these commands from the Docker source directory.
Docker Compose
Use Docker Compose for the standard deployment procedure:
Container Access
Use these commands to enter the container or open a service client:
Image Build
Use these commands to build images:
Image Management
Use these commands to manage images:
Cleanup
Use these commands to remove the selected resources:
The make purge command removes the container and runs rm -rf -- ./data.
It has no countdown prompt.
Before you run it, confirm the current directory and the target data.
Back up any data that you need to keep.
Manual Run
To start the container with docker run, use this command:
You can also use the Makefile command:
How It Works
The image uses Debian 13 (Trixie) with systemd as the initialization system.
Manage services inside the container with systemctl, as on native Linux.
The container has these properties:
- Systemd manages the services.
- SSH permits root access with the password
pigsty. - The
--privilegedoption supplies the access required by systemd. - The
/datavolume keeps data outside the container. - The image includes pig, Ansible, and initialized Pigsty source.
The image build runs these initialization steps:
The ./configure -c docker command selects the Docker configuration template.
This template uses 127.0.0.1 as the default IP address and applies settings for the container environment.
FAQ
Container won’t start
Make sure that Docker is installed and the host meets the resource requirements.
On Docker Desktop, allocate at least 2 GB of memory.
Examine ports 2222, 8080, 8443, and 5432 for conflicts.
Can’t access services
Make sure that ./deploy.yml completed successfully.
The Web Portal and PostgreSQL require this deployment stage.
Run make status to see the service status.
Port conflicts
Change the port in .env or supply an environment variable:
Data persistence
The host directory ./data stores persistent container data.
To remove this data and start again, use these commands:
The purge step deletes the existing data. Back up any required data first.
macOS performance
Docker Desktop on macOS uses a virtual machine. This adds overhead compared with native Linux. Use Docker for development and testing. For production, use native Linux installation.
More
- Docker Hub supplies the image.
- Source Directory contains the Docker configuration and Makefile.
- Native Linux Installation describes single-node deployment.
- Offline Installation describes installation without Internet access.
- Deployment Guide describes production deployment.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)