Netbox not working with postgres error on RPi4

I am trying to get the Netbox container working on a Raspberry Pi 4 running Ubuntu 20.04 64bit and Portainer 2.0. When I try to load Netbox in my browser, I get the following error:

I have no idea what is causing this.

Here is the run command I used to set it up:

docker run -d \
  --name=netbox \
  -e PUID=1000 \
  -e PGID=1000 \
  -e SUPERUSER_EMAIL=admin@netbox.local \
  -e SUPERUSER_PASSWORD=password \
  -e ALLOWED_HOST=my.host.local \
  -e DB_USER=netbox \
  -e DB_PASSWORD=password \
  -e TZ=America/New_York \
  -p 8000:8000 \
  -v /home/ubuntu/.config/appdata/netbox:/config \
  --restart unless-stopped \
  ghcr.io/linuxserver/netbox

Also, here is the container log output from the time the container starts to the time when I start getting the above error:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.,
[s6-init] ensuring user provided files have correct perms...exited 0.,
[fix-attrs.d] applying ownership & permissions fixes...,
[fix-attrs.d] done.,
[cont-init.d] executing container initialization scripts...,
[cont-init.d] 01-envfile: executing... ,
[cont-init.d] 01-envfile: exited 0.,
[cont-init.d] 10-adduser: executing... ,
,
-------------------------------------,
          _         (),
         | |  ___   _    __,
         | | / __| | |  /  \ ,
         | | \__ \ | | | () |,
         |_| |___/ |_|  \__/,
,
,
Brought to you by linuxserver.io,
-------------------------------------,
,
To support LSIO projects visit:,
https://www.linuxserver.io/donate/,
-------------------------------------,
GID/UID,
-------------------------------------,
,
User uid:    1000,
User gid:    1000,
-------------------------------------,
,
[cont-init.d] 10-adduser: exited 0.,
[cont-init.d] 50-config: executing... ,
Traceback (most recent call last):,
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection,
    self.connect(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect,
    self.connection = self.get_new_connection(conn_params),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection,
    connection = Database.connect(**conn_params),
  File "/usr/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect,
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync),
psycopg2.OperationalError: could not translate host name "postgres" to address: Name does not resolve,
,
,
The above exception was the direct cause of the following exception:,
,
Traceback (most recent call last):,
  File "netbox/manage.py", line 10, in <module>,
    execute_from_command_line(sys.argv),
  File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line,
    utility.execute(),
  File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute,
    self.fetch_command(subcommand).run_from_argv(self.argv),
  File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv,
    self.execute(*args, **cmd_options),
  File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute,
    output = self.handle(*args, **options),
  File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 85, in wrapped,
    res = handle_func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 92, in handle,
    executor = MigrationExecutor(connection, self.migration_progress_callback),
  File "/usr/lib/python3.8/site-packages/django/db/migrations/executor.py", line 18, in __init__,
    self.loader = MigrationLoader(self.connection),
  File "/usr/lib/python3.8/site-packages/django/db/migrations/loader.py", line 53, in __init__,
    self.build_graph(),
  File "/usr/lib/python3.8/site-packages/django/db/migrations/loader.py", line 216, in build_graph,
    self.applied_migrations = recorder.applied_migrations(),
  File "/usr/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 77, in applied_migrations,
    if self.has_table():,
  File "/usr/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 55, in has_table,
    with self.connection.cursor() as cursor:,
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 259, in cursor,
    return self._cursor(),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor,
    self.ensure_connection(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection,
    self.connect(),
  File "/usr/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__,
    raise dj_exc_value.with_traceback(traceback) from exc_value,
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection,
    self.connect(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect,
    self.connection = self.get_new_connection(conn_params),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection,
    connection = Database.connect(**conn_params),
  File "/usr/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect,
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync),
django.db.utils.OperationalError: could not translate host name "postgres" to address: Name does not resolve,
,
Traceback (most recent call last):,
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection,
    self.connect(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect,
    self.connection = self.get_new_connection(conn_params),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection,
    connection = Database.connect(**conn_params),
  File "/usr/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect,
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync),
psycopg2.OperationalError: could not translate host name "postgres" to address: Name does not resolve,
,
,
The above exception was the direct cause of the following exception:,
,
Traceback (most recent call last):,
  File "/app/netbox/netbox/manage.py", line 10, in <module>,
    execute_from_command_line(sys.argv),
  File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line,
    utility.execute(),
  File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute,
    self.fetch_command(subcommand).run_from_argv(self.argv),
  File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv,
    self.execute(*args, **cmd_options),
  File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute,
    output = self.handle(*args, **options),
  File "/usr/lib/python3.8/site-packages/django/core/management/commands/shell.py", line 93, in handle,
    exec(sys.stdin.read()),
  File "<string>", line 7, in <module>,
  File "/usr/lib/python3.8/site-packages/cacheops/query.py", line 296, in count,
    return self._no_monkey.count(self),
  File "/usr/lib/python3.8/site-packages/django/db/models/query.py", line 411, in count,
    return self.query.get_count(using=self.db),
  File "/usr/lib/python3.8/site-packages/django/db/models/sql/query.py", line 515, in get_count,
    number = obj.get_aggregation(using, ['__count'])['__count'],
  File "/usr/lib/python3.8/site-packages/django/db/models/sql/query.py", line 500, in get_aggregation,
    result = compiler.execute_sql(SINGLE),
  File "/usr/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1154, in execute_sql,
    cursor = self.connection.cursor(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 259, in cursor,
    return self._cursor(),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor,
    self.ensure_connection(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection,
    self.connect(),
  File "/usr/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__,
    raise dj_exc_value.with_traceback(traceback) from exc_value,
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection,
    self.connect(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect,
    self.connection = self.get_new_connection(conn_params),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection,
    connection = Database.connect(**conn_params),
  File "/usr/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect,
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync),
django.db.utils.OperationalError: could not translate host name "postgres" to address: Name does not resolve,
,
[cont-init.d] 50-config: exited 1.,
[cont-init.d] 99-custom-files: executing... ,
[custom-init] no custom files found exiting...,
[cont-init.d] 99-custom-files: exited 0.,
[cont-init.d] done.,
[services.d] starting services,
[services.d] done.,
[uWSGI] getting INI configuration from uwsgi.ini,
[uwsgi-static] added mapping for /static => static,
*** Starting uWSGI 2.0.18 (64bit) on [Tue Dec 22 12:49:30 2020] ***,
compiled with version: 9.3.0 on 17 April 2020 16:07:02,
os: Linux-5.4.0-1025-raspi #28-Ubuntu SMP PREEMPT Wed Dec 9 17:10:53 UTC 2020,
nodename: 89f6e3d88532,
machine: aarch64,
clock source: unix,
pcre jit disabled,
detected number of CPU cores: 4,
current working directory: /app/netbox/netbox,
detected binary path: /usr/sbin/uwsgi,
your memory page size is 4096 bytes,
detected max file descriptor number: 1048576,
building mime-types dictionary from file /etc/mime.types...1293 entry found,
lock engine: pthread robust mutexes,
thunder lock: disabled (you can enable it with --thunder-lock),
uwsgi socket 0 bound to TCP address :8000 fd 3,
Python version: 3.8.5 (default, Jul 20 2020, 23:11:29)  [GCC 9.3.0],
Python main interpreter initialized at 0xaaaaed3b8400,
python threads support enabled,
your server socket listen backlog is limited to 100 connections,
your mercy for graceful operations on workers is 60 seconds,
mapped 145840 bytes (142 KB) for 1 cores,
*** Operational MODE: single process ***,
running "exec:/usr/bin/python3 ./manage.py collectstatic --noinput" (pre app)...,
,
961 static files copied to '/app/netbox/netbox/static'.,
running "exec:/usr/bin/python3 ./manage.py remove_stale_contenttypes --no-input" (pre app)...,
Traceback (most recent call last):,
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection,
    self.connect(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect,
    self.connection = self.get_new_connection(conn_params),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection,
    connection = Database.connect(**conn_params),
  File "/usr/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect,
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync),
psycopg2.OperationalError: could not translate host name "postgres" to address: Name does not resolve,
,
,
The above exception was the direct cause of the following exception:,
,
Traceback (most recent call last):,
  File "./manage.py", line 10, in <module>,
    execute_from_command_line(sys.argv),
  File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line,
    utility.execute(),
  File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute,
    self.fetch_command(subcommand).run_from_argv(self.argv),
  File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv,
    self.execute(*args, **cmd_options),
  File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute,
    output = self.handle(*args, **options),
  File "/usr/lib/python3.8/site-packages/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py", line 39, in handle,
    apps_content_types = itertools.groupby(,
  File "/usr/lib/python3.8/site-packages/django/db/models/query.py", line 287, in __iter__,
    self._fetch_all(),
  File "/usr/lib/python3.8/site-packages/cacheops/query.py", line 273, in _fetch_all,
    return self._no_monkey._fetch_all(self),
  File "/usr/lib/python3.8/site-packages/django/db/models/query.py", line 1308, in _fetch_all,
    self._result_cache = list(self._iterable_class(self)),
  File "/usr/lib/python3.8/site-packages/django/db/models/query.py", line 53, in __iter__,
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size),
  File "/usr/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1154, in execute_sql,
    cursor = self.connection.cursor(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 259, in cursor,
    return self._cursor(),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor,
    self.ensure_connection(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection,
    self.connect(),
  File "/usr/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__,
    raise dj_exc_value.with_traceback(traceback) from exc_value,
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection,
    self.connect(),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect,
    self.connection = self.get_new_connection(conn_params),
  File "/usr/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner,
    return func(*args, **kwargs),
  File "/usr/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection,
    connection = Database.connect(**conn_params),
  File "/usr/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect,
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync),
django.db.utils.OperationalError: could not translate host name "postgres" to address: Name does not resolve,
,
command "/usr/bin/python3 ./manage.py remove_stale_contenttypes --no-input" exited with non-zero code: 1,
Tue Dec 22 12:49:49 2020 - FATAL hook failed, destroying instance,
SIGINT/SIGQUIT received...killing workers...,
WSGI app 0 (mountpoint='') ready in 10 seconds on interpreter 0xaaaaed3b8400 pid: 272 (default app),
*** uWSGI is running in multiple interpreter mode ***,
spawned uWSGI master process (pid: 272),
spawned uWSGI worker 1 (pid: 296, cores: 1),
[uwsgi-daemons] spawning "/usr/bin/python3 ./manage.py rqworker" (uid: 1000 gid: 1000),
/usr/lib/python3.8/site-packages/cacheops/redis.py:19: RuntimeWarning: The cacheops cache is unreachable! Error: Error -2 connecting to redis:6379. Name does not resolve.,
  warnings.warn("The cacheops cache is unreachable! Error: %s" % e, RuntimeWarning),
[pid: 296|app: 0|req: 1/1] 192.168.10.64 () {38 vars in 785 bytes} [Tue Dec 22 17:50:00 2020] GET / => generated 1866 bytes in 7512 msecs (HTTP/1.1 500) 6 headers in 214 bytes (1 switches on core 0),
Error -2 connecting to redis:6379. Name does not resolve.,
daemon "/usr/bin/python3 ./manage.py rqworker" (pid: 297) annihilated,

Thanks!

Im getting the same.

It appears you need a redis and postgres container for the netbox container to run.

Im currently struggling to get it up on my Pi 3b

version: "2.1"
services:
  netbox:
    image: ghcr.io/linuxserver/netbox
    container_name: netbox
    environment:
      - PUID=1000
      - PGID=1000
      - SUPERUSER_EMAIL= na@na.com
      - SUPERUSER_PASSWORD= Password
      - ALLOWED_HOST= *
      - DB_NAME= netbox
      - DB_USER= netbox
      - DB_PASSWORD= mysecretpassword
      - DB_HOST= postgres
      - DB_PORT= 5432
      - REDIS_HOST= redis
      - REDIS_PORT= 6379
      - TZ= Europe/London
    volumes:
      - /home/netbox:/config
    ports:
      - 8000:8000
    restart: unless-stopped
  
  postgres:
    image: postgres
    container_name: postgres
    environment:
      - POSTGRES_USER=netbox
      - POSTGRES_DB=netbox
      - POSTGRES_PASSWORD=mysecretpassword
    volumes:
      - /home/netbox/postgres:/var/lib/postgresql/data
    ports:
      - 5432:5432/tcp
    restart: unless-stopped
 
  redis:
    image: redis
    container_name: redis
    volumes:
      - /home/netbox:/data
    restart: unless-stopped

Heres what I have so far and still get get that error, im sure someone will work it out and get it added to the docs with an example