Self-host Snipe-IT with Docker Compose
IT asset management for tracking hardware, licences and who has what.
snipe-it
mysql
mariadb:12.2.2-noble
mysql-mysql-data-init
busybox
mysql-mysql-socket-init
busybox
mysql-mysql-tmp-init
busybox
snipe-it-bootstrap-cache-init
busybox
snipe-it-data-init
busybox
snipe-it-storage-init
busybox
snipe-it-tmp-init
busybox
The steps below take a few minutes end to end.
Requirements
You'll need these installed on the machine you're deploying to:
Docker
Packages Snipe-IT and everything it depends on into an isolated container, so it runs the same way on your machine as it does everywhere else.
Install guideDocker Compose
Reads docker-compose.yml and starts everything in it together. Ships with Docker Desktop. On Linux servers it's usually a separate install.
Install guide1. Docker compose setup and file
Create a folder for Snipe-IT and save the file below into it as docker-compose.yml. It describes every container the stack needs — Snipe-IT itself and any supporting services, such as its database — along with the ports, volumes and environment variables each one uses. You'll also need an empty .env file in the same folder; Docker Compose reads it automatically and uses it to fill in the ${VARIABLE} references you'll see in the file below.
docker-compose.yml
version: "3.9"
services:
mysql:
image: mariadb:12.2.2-noble
restart: unless-stopped
environment:
MARIADB_DATABASE: app
MARIADB_PASSWORD: ${RANDOM_MYSQL_PASSWORD}
MARIADB_ROOT_PASSWORD: ${RANDOM_MYSQL_ROOT_PASSWORD}
MARIADB_USER: app
volumes:
- mysql-data:/var/lib/mysql
- mysql-tmp:/tmp
- mysql-socket:/run/mysqld
depends_on:
mysql-mysql-data-init:
condition: service_completed_successfully
mysql-mysql-socket-init:
condition: service_completed_successfully
mysql-mysql-tmp-init:
condition: service_completed_successfully
mysql-mysql-data-init:
image: busybox
volumes:
- mysql-data:/var/lib/mysql
command:
- chown
- 999:999
- /var/lib/mysql
mysql-mysql-socket-init:
image: busybox
volumes:
- mysql-socket:/run/mysqld
command:
- chown
- 999:999
- /run/mysqld
mysql-mysql-tmp-init:
image: busybox
volumes:
- mysql-tmp:/tmp
command:
- chown
- 999:999
- /tmp
snipe-it:
image: snipe/snipe-it:v8.8.3
restart: unless-stopped
ports:
- 8080:8080
environment:
APP_DEBUG: "false"
APP_ENV: production
APP_FORCE_TLS: "true"
APP_KEY: base64:${RANDOM_APP_KEY_RAW}
APP_KEY_RAW: ${RANDOM_APP_KEY_RAW}
APP_TRUSTED_PROXIES: '*'
APP_URL: http://snipe-it.localhost:8080
DB_CONNECTION: mysql
DB_DATABASE: app
DB_HOST: 127.0.0.1
DB_PASSWORD: ${RANDOM_MYSQL_PASSWORD}
DB_PORT: "3306"
DB_USERNAME: app
volumes:
- data:/var/lib/snipeit
- storage:/var/www/html/storage
- bootstrap-cache:/var/www/html/bootstrap/cache
- tmp:/tmp
depends_on:
mysql:
condition: service_started
snipe-it-bootstrap-cache-init:
condition: service_completed_successfully
snipe-it-data-init:
condition: service_completed_successfully
snipe-it-storage-init:
condition: service_completed_successfully
snipe-it-tmp-init:
condition: service_completed_successfully
entrypoint:
- bash
- -c
- |
set -e
for d in data/private_uploads/assets data/private_uploads/accessories data/private_uploads/audits \
data/private_uploads/components data/private_uploads/consumables data/private_uploads/eula-pdfs \
data/private_uploads/imports data/private_uploads/models data/private_uploads/users \
data/private_uploads/licenses data/private_uploads/signatures data/uploads/accessories \
data/uploads/assets data/uploads/avatars data/uploads/barcodes data/uploads/categories \
data/uploads/companies data/uploads/components data/uploads/consumables data/uploads/departments \
data/uploads/locations data/uploads/maintenances data/uploads/manufacturers data/uploads/models \
data/uploads/suppliers dumps keys; do mkdir -p "/var/lib/snipeit/$$d"; done
cat > /tmp/httpd.conf <<'CONF'
ServerRoot /etc/apache2
ServerName localhost
Listen 8080
PidFile /tmp/apache2.pid
DefaultRuntimeDir /tmp
Mutex file:/tmp default
ErrorLog /dev/stderr
LogLevel warn
LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so
LoadModule authz_core_module /usr/lib/apache2/modules/mod_authz_core.so
LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so
LoadModule mime_module /usr/lib/apache2/modules/mod_mime.so
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
LoadModule env_module /usr/lib/apache2/modules/mod_env.so
LoadModule setenvif_module /usr/lib/apache2/modules/mod_setenvif.so
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule filter_module /usr/lib/apache2/modules/mod_filter.so
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
LoadModule php_module /usr/lib/apache2/modules/libphp8.3.so
TypesConfig /etc/mime.types
StartServers 4
MinSpareServers 4
MaxSpareServers 8
MaxRequestWorkers 24
KeepAlive On
KeepAliveTimeout 2
DocumentRoot /var/www/html/public
DirectoryIndex index.php
<Directory />
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/html/public>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<FilesMatch "\.php$$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
CONF
until (echo > /dev/tcp/$$DB_HOST/$$DB_PORT) 2>/dev/null; do sleep 1; done
[ -f /var/lib/snipeit/keys/oauth-private.key ] || php artisan passport:keys --force
php artisan migrate --force
php artisan config:cache
exec apache2 -f /tmp/httpd.conf -DFOREGROUND
snipe-it-bootstrap-cache-init:
image: busybox
volumes:
- bootstrap-cache:/var/www/html/bootstrap/cache
command:
- chown
- "10000:50"
- /var/www/html/bootstrap/cache
snipe-it-data-init:
image: busybox
volumes:
- data:/var/lib/snipeit
command:
- chown
- "10000:50"
- /var/lib/snipeit
snipe-it-storage-init:
image: busybox
volumes:
- storage:/var/www/html/storage
command:
- chown
- "10000:50"
- /var/www/html/storage
snipe-it-tmp-init:
image: busybox
volumes:
- tmp:/tmp
command:
- chown
- "10000:50"
- /tmp
volumes:
bootstrap-cache: null
data: null
mysql-data: null
mysql-socket: null
mysql-tmp: null
storage: null
tmp: null
Volumes
Snipe-IT stores its data in named Docker volumes, so it survives container restarts and updates:
- data mounted at /var/lib/snipeit: Snipe-IT's uploaded files (asset images, signatures, EULAs, imports), backups and OAuth keys.
- storage mounted at /var/www/html/storage: Laravel's working storage for cache, sessions, compiled views and logs.
- bootstrap-cache mounted at /var/www/html/bootstrap/cache: Laravel's cached configuration and service manifests, rebuilt at startup.
- tmp mounted at /tmp: Temporary files.
2. Secret generation
Snipe-IT needs a few randomly generated secrets — for example, database passwords or an internal session key — before it can start. These are referenced from docker-compose.yml above but don't live in it, so they need to end up in your .env file. Pick one of the two options below.
Generating secrets…
3. Start Snipe-IT with Docker Compose
From the folder with docker-compose.yml and .env, run:
Terminal
Start Snipe-IT and all its supporting services in the background.
docker compose up -dThe -d flag runs the stack in the background so it keeps running after you close the terminal. Docker will pull the images the first time, which can take a minute or two.
To check on it afterwards: docker compose ps shows whether containers are healthy, and docker compose logs -f follows their logs if something looks wrong. Once it's running, open http://localhost:8080 in your browser.