Skip to main content
Learn how to deploy Infisical using Docker Compose. This method runs Infisical and its dependencies (PostgreSQL and Redis) as containers on a single Docker host. It’s ideal for trying out Infisical, development environments, or small-scale deployments that don’t require high availability. The short video below walks through deploying Infisical with Docker Compose, covering each step from setup to a running instance.

Prerequisites

  • A Linux server (Ubuntu 20.04+ recommended) or macOS/Windows with Docker Desktop
  • Docker Engine (version 20.10+)
  • Docker Compose (version 2.0+ recommended)
This Docker Compose configuration is not designed for high-availability production scenarios. It includes just the essential components needed to set up an Infisical proof of concept (POC). To run Infisical in a highly available manner, see the Kubernetes guide.

System Requirements

The following are minimum requirements for running Infisical with Docker Compose: These requirements include resources for Infisical, PostgreSQL, and Redis containers. For larger deployments with many secrets or users, increase resources accordingly.

Deployment Steps

1

Verify prerequisites

Confirm that Docker and Docker Compose are installed on your machine:
You should see version information for both commands. If not, install Docker and Docker Compose following the official documentation.
2

Download the Docker Compose file

You can obtain the Infisical docker compose file by using a command-line downloader such as wget or curl. If your system doesn’t have either of these, you can use an equivalent command that works with your machine.
3

Configure environment variables

Infisical requires a set of credentials used for connecting to dependent services such as Postgres, Redis, etc. The default credentials can be downloaded using one of the commands listed below.
Once downloaded, the credentials file will be saved to your working directory as .env file. View all available configurations here.
The .env file contains secrets that control the security of your deployment. Do not commit it to version control, and protect access to it:
4

Start Infisical

Start all services in detached mode:
This command starts three containers:
  • backend: The main Infisical application (exposed on host port 80, internal port 8080)
  • db: PostgreSQL database for storing encrypted secrets
  • redis: Redis for caching and job queues
5

Verify the deployment

Check that all containers are running:
You should see all three services with a status of Up. Next, verify Infisical is responding:
If successful, open your browser and navigate to http://localhost:80 (or your configured domain) to create your admin account.
The first user to sign up becomes the instance administrator. Make sure to complete this step before exposing Infisical to others.

Managing Your Deployment

Stopping and Restarting Services

To stop all Infisical services:
To restart services:
To restart a specific service (e.g., after configuration changes):

Data Persistence and Volumes

The Docker Compose configuration uses named volumes to persist data:
Critical: The pg_data volume contains all your encrypted secrets. Never delete this volume unless you intend to lose all data. Always back up before any maintenance operations.
To view volumes:
To back up the PostgreSQL volume:

Viewing Logs

To view logs from all services:
To view logs from a specific service:
To view the last 100 lines of logs:
Logs are also available directly from Docker:

Additional Configuration

Configure your firewall to allow traffic to Infisical while securing other services:Required ports:Internal ports (should NOT be exposed publicly):UFW (Ubuntu/Debian):
firewalld (RHEL/CentOS):
Never expose PostgreSQL (5432) or Redis (6379) ports to the public internet. These should only be accessible within the Docker network.
Infisical uses email for user invitations, password resets, and notifications. Configure SMTP by adding these variables to your .env file:
Common SMTP providers:
After updating the .env file, restart Infisical:
We recommend securing your Infisical deployment with HTTPS using a reverse proxy like NGINX.1. Obtain SSL certificates (e.g., via Let’s Encrypt):
2. Create NGINX configuration directory:
3. Add NGINX service to docker-compose.prod.yml:
4. Create ./nginx/nginx.conf:
5. Update .env:
6. Restart services:
For higher availability, use external managed services like AWS RDS and ElastiCache.Update your .env:
Remove or comment out db and redis services in docker-compose.prod.yml.Ensure firewall/VPC access to these services is properly configured.
Regular backups are critical for protecting your data.Database backup:
Automated daily backups (cron):
Restore from backup:
Also back up your ENCRYPTION_KEY from the .env file. Without this key, you cannot decrypt secrets even if you restore the database.
Infisical exposes Prometheus metrics when enabled.1. Add to .env:
2. Expose port 9464 in docker-compose.prod.yml by adding to the backend service:
3. Configure Prometheus to scrape localhost:9464 or the container DNS.See the Monitoring Guide for full setup.
Keeping Infisical up-to-date ensures you receive the latest features and security patches.1. Back up your database:
2. Update the image tag in docker-compose.prod.yml to the desired version.3. Pull and restart:
4. Verify the upgrade:
Watch for successful database migration messages. See the Upgrade Guide for more details.

Troubleshooting

Check container status:
View startup logs:
Common causes:
  • Port 80 already in use: Stop other services or change the port mapping
  • Insufficient memory: Ensure at least 4GB RAM is available
  • Invalid .env file: Check for syntax errors or missing required variables
Check if PostgreSQL is running:
Verify database credentials:
Check Infisical logs for connection errors:
If the database was corrupted, you may need to restore from backup or recreate the volume:
Verify the service is running:
Check if the port is listening:
Check firewall rules:
Verify SITE_URL is correct in your .env file and matches how you’re accessing Infisical.
Test SMTP connectivity:
Check Infisical logs for email errors:
Common issues:
  • Incorrect SMTP credentials
  • Firewall blocking outbound port 587 or 465
  • SMTP provider requires specific authentication (e.g., Gmail App Passwords)
Check resource usage:
Check for slow database queries:
Solutions:
  • Increase container memory limits in docker-compose.prod.yml
  • Add more CPU cores to the host
  • Consider migrating to a managed database for better performance
If you have lost access to your admin account, you can reset it via the database:
For security reasons, passwords are hashed and cannot be directly reset in the database. Use the “Forgot Password” flow if SMTP is configured, or contact Infisical support for assistance.

Your Infisical instance should now be running on port 80 (or 443 if using TLS). Visit http://localhost:80 or https://<your-domain> to access your instance. self-hosted sign up