netbox-docker Documentation

repository·release·Indexed 25 days ago

https://github.com/netbox-community/netbox-docker

Components and orchestration for running NetBox as a containerized application using Docker Compose. Includes instructions for installation, superuser creation, image tag management, and configuration of PostgreSQL, Redis, and Valkey services.

Tokens
1.2K
Snippets
7
Records
10
Agent score
33%

What's inside netbox-docker

  1. Quickstart: Install and run NetBox Docker

    release

    To get NetBox Docker up and running, clone the release branch, prepare the override configuration, and start the containers using Docker Compose. Once running, the application is accessible at http://0.0.0.0:8000/.

    git clone -b release https://github.com/netbox-community/netbox-docker.git
    cd netbox-docker
    # Copy the example override file
    cp docker-compose.override.yml.example docker-compose.override.yml
    # Read and edit the file to your liking
    docker compose pull
    docker compose up
  2. Create the first NetBox admin user

    release

    After the containers are running, you must create a superuser to access the NetBox web interface. Run the createsuperuser command via docker compose exec targeting the netbox service.

    docker compose exec netbox /opt/netbox/netbox/manage.py createsuperuser
  3. Configure PostgreSQL database settings

    release

    The postgres service uses the docker.io/postgres:18-alpine image. Database credentials and configuration are managed via the env/postgres.env file. Data is persisted in the netbox-postgres volume.

    services:
      postgres:
        image: docker.io/postgres:18-alpine
        env_file: env/postgres.env
        volumes:
          - netbox-postgres:/var/lib/postgresql
  4. Configure Redis/Valkey services

    release

    NetBox uses Valkey (a Redis compatible provider) for both standard Redis tasks and caching.

    • redis: Uses env/redis.env and persists data in netbox-redis-data.
    • redis-cache: Uses env/redis-cache.env and persists data in netbox-redis-cache-data.

    Both services require the REDIS_PASSWORD environment variable to be set for authentication.

    services:
      redis:
        image: docker.io/valkey/valkey:9.1-alpine
        env_file: env/redis.env
        volumes:
          - netbox-redis-data:/data
      redis-cache:
        image: docker.io/valkey/valkey:9.1-alpine
        env_file: env/redis-cache.env
        volumes:
          - netbox-redis-cache-data:/data
  5. Configure NetBox service volumes and environment

    release

    The netbox service uses specific volume mounts for configuration and data persistence. Configuration is read from a local directory, while media, reports, and scripts are stored in named volumes. Environment variables are loaded from env/netbox.env.

    services:
      netbox:
        image: docker.io/netboxcommunity/netbox:${VERSION-v4.6-5.0.2}
        env_file: env/netbox.env
        volumes:
          - ./configuration:/etc/netbox/config:z,ro
          - netbox-media-files:/opt/netbox/netbox/media:rw
          - netbox-reports-files:/opt/netbox/reports:rw
          - netbox-scripts-files:/opt/netbox/netbox/scripts:rw
  6. Reference: Container Image Tags

    release
    NetBox Docker images are published to Docker Hub, Quay.io, and GitHub Container Registry. For production, it is recommended to use specific version tags (e.g., vX.Y.Z-a.b.c) to ensure compatibility between the NetBox version and the Docker support files.