Can I Use Snipe-IT with Docker? Complete Setup and Configuration Guide

Yes, Snipe-IT fully supports Docker deployment with official images, production-ready Dockerfiles, and docker-compose configurations that allow you to run the complete asset management stack using containers.

The grokability/snipe-it repository ships with first-class containerization support, including Alpine-based and FPM-based Dockerfiles alongside a production-grade docker-compose.yml. These resources enable you to deploy Snipe-IT using pre-built images from Docker Hub or build custom images tailored to your infrastructure requirements.

Snipe-IT Docker Architecture Overview

Snipe-IT’s Docker implementation separates the web application from the database using standard container orchestration patterns. The architecture consists of an Apache + PHP container running the Laravel application and a MariaDB container handling data persistence.

The Alpine Dockerfile

The primary Dockerfile.alpine builds a lightweight image based on Alpine Linux that includes:

  • Apache web server with mod_rewrite enabled to handle Snipe-IT’s URL routing requirements
  • PHP 8.4 with required extensions including pdo_mysql, gd, zip, and mbstring
  • Composer for dependency management
  • Persistent volume at /var/lib/snipeit for uploads, backups, and OAuth keys

According to the source code in Dockerfile.alpine, the build process configures Apache’s PID location, copies the application source to /var/www/html, and injects default environment variables from docker/docker.env. The container uses docker/startup_alpine.sh as its entrypoint to initialize Apache and run database migrations automatically on startup.

Docker Compose Orchestration

The docker-compose.yml file defines two essential services:

  1. app: Uses the snipe/snipe-it:${APP_VERSION:-latest} image and maps host port ${APP_PORT:-8000} to container port 80
  2. db: Runs mariadb:11.4.7 with health checks to ensure the database is ready before the application starts

The compose configuration mounts a named storage volume to /var/lib/snipeit, ensuring that uploaded assets, backups, and keys survive container recreation. All database credentials and application settings are injected via environment variables from a .env file.

Quick Start: Deploy Snipe-IT with Docker Compose

The fastest way to run Snipe-IT with Docker uses the provided compose file. This method automatically handles networking between the application and database containers.

  1. Clone the repository and enter the directory:
git clone https://github.com/grokability/snipe-it.git
cd snipe-it
  1. Create your environment configuration from the example file:
cp .env.example .env

Edit .env to set database credentials, application URL, and other required variables.

  1. Start the container stack:
docker compose up -d

Once the containers report healthy status, access Snipe-IT at http://localhost:8000 (or your configured APP_PORT) and complete the web-based installation wizard.

Running Snipe-IT with Docker Run (Without Compose)

You can also run Snipe-IT directly using the official Docker Hub image without cloning the repository. This approach works well for testing or simplified deployments.

docker run -d \
  --name snipe-it \
  -p 8000:80 \
  -v snipeit-data:/var/lib/snipeit \
  --env-file .env \
  snipe/snipe-it:latest

This command creates a persistent named volume snipeit-data that stores user uploads, system backups, and OAuth encryption keys at /var/lib/snipeit inside the container. Ensure your .env file contains valid DB_HOST, DB_DATABASE, DB_USERNAME, and DB_PASSWORD values pointing to an accessible database server.

Building Custom Snipe-IT Docker Images

For environments requiring specific PHP extensions or custom configurations, build your own image from the provided Dockerfiles. The repository includes two variants:

  • Dockerfile.alpine: Apache-based image using mod_php (recommended for most users)
  • Dockerfile.fpm-alpine: PHP-FPM-based image for use with external web servers like Nginx

To build a custom Alpine image with additional packages:


# In the repository root

docker build -f Dockerfile.alpine -t my-snipe-it:custom .

# Run your custom build

docker run -d -p 8000:80 --env-file .env my-snipe-it:custom

Modify the apk add instructions in Dockerfile.alpine to include system dependencies before the RUN commands that install PHP extensions. The build copies your local source code and applies the initialization logic from docker/startup_alpine.sh.

Data Persistence and Volume Management

Snipe-IT stores three categories of data that must persist beyond container lifecycles:

  • User uploads (asset images, import files)
  • System backups (database dumps generated by the application)
  • OAuth keys (encryption keys for API authentication)

As implemented in Dockerfile.alpine, the container creates symlinks from storage/private_uploads, public/uploads, and storage/app/backups to /var/lib/snipeit. When you mount a volume to /var/lib/snipeit, these symlinks ensure the application continues writing to its expected local paths while actually persisting data to the host-managed volume.

The docker-compose.yml declares this as a named volume:

volumes:
  storage:
    driver: local

For production deployments, consider mounting host directories or networked storage to /var/lib/snipeit rather than using anonymous volumes, enabling easier backup and migration strategies.

Summary

  • Snipe-IT provides official Docker support through the grokability/snipe-it repository with production-ready configurations
  • Two deployment methods are available: pre-built images from Docker Hub (snipe/snipe-it) or building from Dockerfile.alpine/Dockerfile.fpm-alpine
  • Docker Compose is the recommended approach, orchestrating the Apache/PHP application container with a MariaDB database container
  • Persistent storage is handled through /var/lib/snipeit volumes that preserve uploads, backups, and OAuth keys across container restarts
  • Automatic initialization occurs via docker/startup_alpine.sh, which starts Apache and executes Laravel migrations when containers launch

Frequently Asked Questions

Can I use Snipe-IT with Docker in production?

Yes, the Docker implementation is production-ready. The docker-compose.yml uses specific MariaDB version tags (11.4.7) rather than floating tags, and the Alpine Dockerfile creates a hardened environment with persistent volume support. For production deployments, ensure you use named volumes or bind mounts for /var/lib/snipeit, configure proper environment variables in .env, and set up database backups outside the container.

What database does Snipe-IT use with Docker?

The default docker-compose.yml configures a MariaDB 11.4.7 container as the database backend. The application connects using standard Laravel database configuration values passed through environment variables. You can also configure Snipe-IT to use an external MySQL or MariaDB server by modifying the DB_HOST variable in your .env file to point outside the container network.

How do I upgrade Snipe-IT running in Docker?

To upgrade, pull the latest image tag (snipe/snipe-it:latest) or rebuild your custom image from the updated repository source, then restart the containers. The startup_alpine.sh entrypoint automatically runs database migrations (php artisan migrate) during container startup, ensuring schema updates apply before the application serves traffic. Always backup your database and /var/lib/snipeit volume before upgrading.

Where are uploaded files stored in the Snipe-IT Docker container?

Uploaded files are stored in /var/lib/snipeit inside the container, which maps to the Laravel application directories through symlinks created during the Docker build. Specifically, storage/private_uploads, public/uploads, and storage/app/backups are symlinked to subdirectories within /var/lib/snipeit. When using Docker Compose, this path is backed by the named storage volume, ensuring file persistence across container recreations.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →