docker-compose.yml

version: "2.1"
services:
	nb_app:
		image: lscr.io/linuxserver/netbox:latest
		container_name: netbox
		environment:
			- PUID=1000
			- PGID=1000
			- TZ=${TZ}
			- SUPERUSER_EMAIL=${SUPERUSER_EMAIL}
			- SUPERUSER_PASSWORD=${SUPERUSER_PASSWORD}
			- ALLOWED_HOST=${ALLOWED_HOST}
			- DB_NAME=netbox
			- DB_USER=netbox
			- DB_PASSWORD=${DB_PASSWORD}
			- DB_HOST=nb_db
			- DB_PORT=5432
			- REDIS_HOST=nb_redis
			- REDIS_PORT=6379
			- REDIS_PASSWORD=${REDIS_PASSWORD}
			- REDIS_DB_TASK=0
			- REDIS_DB_CACHE=1
		depends_on:
			- nb_db
			- nb_redis
		volumes:
			- /netbox/app:/config
		ports:
			- 8000:8000
		restart: unless-stopped
	nb_db:
		image: postgres:latest
		restart: unless-stopped
		volumes:
      - /netbox/db-data:/var/lib/postgresql/data
		environment:
			- POSTGRES_PASSWORD=${DB_PASSWORD}
			- POSTGRES_DB=netbox
			- POSTGRES_USER=netbox
	nb_redis:
		image: redis:latest
		restart: unless-stopped
		command: redis-server --loglevel warning --requirepass ${REDIS_PASSWORD}
		volumes:
			- /netbox/redis:/data

.env

TZ=America/Chicago
SUPERUSER_EMAIL=example@example.com
SUPERUSER_PASSWORD=your_secure_pw
ALLOWED_HOST=netbox.example.com
DB_PASSWORD=your_secure_db_pw
REDIS_PASSWORD=your_secure_redis_pw
5/5 (2 Reviews)