How to Install Snipe-IT on a VPS with Docker: Self-Hosted IT Asset Management
Picture an IT team asked a simple question: who holds a particular laptop right now, when does its warranty expire, and which licenses are installed on it? The answers are scattered — some in a spreadsheet last updated three months ago, some in chat messages, some known only to one person. When that person goes on leave, tracking stops. A spreadsheet can hold a list of assets, but it has no concept of checkout and check-in: items change hands without a trace, and nothing reminds anyone when an asset should be returned or renewed.
Snipe-IT fixes that mess in an orderly way. This open source application is built specifically for IT asset management: hardware, software licenses, accessories, and components, together with who holds each item, where it sits, and what state it is in. It keeps a history per asset, sends reminders, prints barcode labels, and imports in bulk from CSV. This guide installs it on a VPS with Docker Compose using the official snipe/snipe-it image and MariaDB as its database, then puts it behind an Nginx reverse proxy with HTTPS.
Prerequisites
- A Linux VPS with Docker and Docker Compose v2 installed.
- A domain pointing at the VPS IP, for example
assets.example.com. This guide uses that domain; replace it with your own. - SSH access to the VPS with
sudorights. - Ports 80 and 443 open in the VPS firewall and in the cloud provider firewall, if any.
Check Docker and Compose on the VPS first:
docker --version
docker compose versionExpected output: both commands print a version number without errors.
Step 1: download the official Compose file and .env
Snipe-IT ships a Compose file and a sample .env in its official GitHub repository, and its documentation recommends using those files as they are. Create a working folder and download both:
sudo mkdir -p /opt/snipeit
cd /opt/snipeit
sudo curl https://raw.githubusercontent.com/snipe/snipe-it/master/docker-compose.yml --output docker-compose.yml
sudo curl https://raw.githubusercontent.com/snipe/snipe-it/master/.env.docker --output .envThat Compose file defines two services: app runs the snipe/snipe-it image and exposes port ${APP_PORT:-8000} to the container's port 80, while db runs MariaDB 11.4.7 with a built-in healthcheck. Application data lives in a volume named storage, mounted at /var/lib/snipeit, and database data in the db_data volume. The app service only starts once db reports healthy, so Compose handles the startup order for you.
The curl commands above pull from the official repository's master branch. If you want a version that is exactly reproducible when restoring, set APP_VERSION in .env to a tag from the Docker Hub tags page — the official documentation explicitly advises against the latest tag for long-term use, because the running version becomes hard to pin down at restore time.
Step 2: generate an APP_KEY and fill in the required settings
In .env, the sections marked REQUIRED are the ones you must review. The three most important values are APP_KEY, APP_URL, and the database passwords.
First, generate a fresh application key. This runs it through the app service without starting the whole stack:
sudo docker compose run --rm app php artisan key:generate --showExpected output: a single line starting with base64: followed by random characters. Copy that value — do not keep the sample APP_KEY that ships in the downloaded .env, since that sample value is public.
Then open .env and change the following values:
sudo nano .envAPP_KEY=base64:THE_VALUE_YOU_JUST_GENERATED
APP_URL=https://assets.example.com
APP_TIMEZONE='UTC'
DB_DATABASE=snipeit
DB_USERNAME=snipeit
DB_PASSWORD=PUT_A_STRONG_PASSWORD_HERE
MYSQL_ROOT_PASSWORD=PUT_A_DIFFERENT_STRONG_ROOT_PASSWORD_HEREWhat each of these does:
APP_URLmust match exactly the address users will use to open Snipe-IT, includinghttps://. It is used to build links in notification emails and across the application.DB_PASSWORDis the password for the application database user (snipeit), whileMYSQL_ROOT_PASSWORDis the MariaDB root password. They must be different and strong; Compose passes both to the database container.APP_TIMEZONEtakes a standard timezone identifier, for exampleEurope/LondonorAsia/Jakarta.- If you run behind a reverse proxy later, mind
APP_TRUSTED_PROXIESin.env: include the Docker network range (for example172.16.0.0/12) so Snipe-IT trusts theX-Forwarded-*headers from Nginx. Without it, the application may think every visit arrives over plain HTTP and fall into redirect loops.
The mail settings (MAIL_*) in .env can wait; email notifications do not block the installation, and you can fill them in once the application runs. Save the file (Ctrl+O, Enter, Ctrl+X in nano).
Step 3: start it and check the status
From /opt/snipeit, run:
sudo docker compose up -dWait about a minute for MariaDB to finish initializing on the first start, then check the status:
sudo docker compose ps
sudo docker compose logs --tail=50 appExpected output: the app and db services show as running (or Up), and the app log shows the application listening on port 80 with no database connection errors. If the log shows repeated connection errors, the usual causes are a password mismatch in .env between the application side and the database side, or a db container that is not healthy yet — inspect it with sudo docker compose logs --tail=50 db.
Step 4: finish setup in the browser
Open http://YOUR_VPS_IP:8000 in a browser. Snipe-IT shows its initial setup screen. Follow the wizard: create the first administrator account, fill in the site name and basic settings, then reach the dashboard. On later visits, the standard login page appears instead.
Once inside, three things are worth trying right away to grasp the workflow. First, create one asset: under Assets, add a laptop with its serial number and purchase date. Second, check that asset out to a user — this is where Snipe-IT differs from a spreadsheet, because every handover is recorded with a date and a holder. Third, reopen the asset page and look at its history tab: every event is listed in order. From here, the basic structure is ready to use: categories to group item types, locations for buildings or rooms, and statuses to separate assets in use, available, or under repair.
Step 5: add an Nginx reverse proxy and HTTPS
Port 8000 should not stay open to the public permanently. Point the domain at the container through Nginx, then secure it with Let's Encrypt. Create an Nginx configuration file:
sudo nano /etc/nginx/sites-available/snipeitserver {
listen 80;
server_name assets.example.com;
client_max_body_size 100M;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}Enable it, test the configuration, and issue a certificate:
sudo ln -s /etc/nginx/sites-available/snipeit /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
sudo certbot --nginx -d assets.example.comExpected output: nginx -t answers syntax is ok and test is successful, and Certbot confirms the certificate was issued. After that, open https://assets.example.com — Snipe-IT should load over HTTPS. If you only switch APP_URL to https:// at this stage rather than from the start, remember an important rule from the official documentation: editing .env and then running docker compose restart is not enough, because a restarted container keeps its old environment. Run sudo docker compose up -d so the container is recreated with the new values, while the data volumes stay intact.
Step 6: back it up before the inventory grows
Once filled, the inventory is operational data — losing the database means losing the entire asset history. Two volumes belong in the backup plan: db_data (the MariaDB database) and storage (uploaded files such as asset photos and attachments). This command dumps the database without stopping the containers:
sudo docker compose exec db mariadb-dump -u root -p'YOUR_ROOT_PASSWORD' snipeit > /opt/snipeit/backup-snipeit.sqlReplace YOUR_ROOT_PASSWORD with the value from your .env. Store the dump together with a copy of the storage volume somewhere off the VPS, and schedule the command with cron once you are confident the dump restores cleanly.
Troubleshooting
The setup screen shows a database connection error.
Check three things in order: (1) the db container is healthy (sudo docker compose ps), (2) DB_PASSWORD and MYSQL_ROOT_PASSWORD in .env match what Compose passes — if you changed them after the first start, the already-initialized database does not change with them, so you must either wipe the db_data volume and start over, or change the password directly in MariaDB, (3) DB_HOST=db is untouched, because that Compose service name is the database hostname.
After login, pages loop redirects or keep falling back to HTTP.
This is the classic symptom of an APP_URL still set to http:// while access already goes through HTTPS, or of APP_TRUSTED_PROXIES not covering the Docker network. Fix both in .env, then recreate the container with sudo docker compose up -d — not just restart.
Error: "No application encryption key has been specified".APP_KEY in .env is empty or does not start with base64:. Regenerate it with the key:generate --show command from step 2, paste it exactly with no extra spaces, then run sudo docker compose up -d.
The app container restarts in a loop.
Read its log: sudo docker compose logs --tail=100 app. If the cause is wrong permissions on the storage volume after a manual restore, fix ownership from inside the container; if the image was corrupted during pull, fetch it again with sudo docker compose pull app.
Updating to a newer version.
The official documentation recommends the same flow as installation: change APP_VERSION in .env to the target tag, run sudo docker compose pull && sudo docker compose up -d, then check the log and the login page. Never run docker compose down -v — the -v flag deletes the volumes along with all their data, and the command does not ask for confirmation.
Summary table
| Component | Role | Port / location |
|---|---|---|
app (snipe/snipe-it) | The Snipe-IT application | 8000 on the host, 80 in the container |
| db (MariaDB 11.4.7) | The inventory database | Volume db_data |
Volume storage | Asset photos, attachments, uploads | /var/lib/snipeit in the container |
.env | APP_KEY, APP_URL, database passwords, mail | /opt/snipeit/.env |
| Nginx + Certbot | HTTPS for the public domain | Ports 80 and 443 |
Pre-finish checklist
- The
appanddbcontainers are running, and theapplog is free of database connection errors. APP_KEYhas been replaced from the sample value, andAPP_URLmatches exactly the domain users open.- The first administrator account is created and can log in.
- One asset has been created and checked out to a user, and the event appears in the asset history.
- The domain loads over
https://with a valid certificate. - The database dump and the
storagevolume are covered by a recurring backup plan. APP_VERSIONis pinned to a version tag if this installation will run long-term.
One maintenance note: update the image periodically with sudo docker compose pull && sudo docker compose up -d from /opt/snipeit, then check the log afterwards. The storage and db_data volumes are untouched as long as you do not add the -v flag to a down command.
Have you ever lost track of a company asset because the inventory only lived in a spreadsheet? Which part of Snipe-IT would you use first — asset checkout, license tracking, or barcode labels? Tell us in the comments, and if any step above fails on your VPS, paste the error message so it can be discussed together.
Read also: the Rnevio article “Docker Compose for Self-Hosting from Scratch” explains the Compose pattern used in this guide from the ground up, while the companion guide in this batch is available in the Kimai guide for self-hosted time tracking on a VPS.


Diskusi
Ada pertanyaan atau pengalaman yang ingin dibagikan?
Komentar ditinjau sebelum ditampilkan. Mari berdiskusi dengan sopan dan sesuai topik.
Tulis komentar