mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2025-08-15 18:42:29 +02:00
Updated Troubleshooting (markdown)
@ -5,15 +5,63 @@ If your issue is not here, look through [the existing issues][issues] and eventu
|
||||
|
||||
### Docker Compose basics
|
||||
|
||||
* You can see all running containers belonging to this project using `docker-compose ps`.
|
||||
* You can see the logs by running `docker-compose logs -f`.
|
||||
Running `docker-compose logs -f netbox` will just show the logs for netbox.
|
||||
* You can stop everything using `docker-compose stop`.
|
||||
* You can clean up everything using `docker-compose down -v --remove-orphans`. **This will also remove any related data.**
|
||||
* You can enter the shell of the running Netbox container using `docker-compose exec netbox /bin/bash`. Now you have access to `./manage.py`, e.g. to reset a password.
|
||||
* To access the database run `docker-compose exec postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'`
|
||||
* To create a database backup run `docker-compose exec postgres sh -c 'pg_dump -cU $POSTGRES_USER $POSTGRES_DB' | gzip > db_dump.sql.gz`
|
||||
* To restore that database backup run `gunzip -c db_dump.sql.gz | docker exec -i $(docker-compose ps -q postgres) sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'`.
|
||||
See all running containers:
|
||||
|
||||
```bash
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
See all logs:
|
||||
|
||||
```bash
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
See just the Netbox logs:
|
||||
|
||||
```bash
|
||||
docker-compose logs -f netbox
|
||||
```
|
||||
|
||||
Stop it all:
|
||||
|
||||
```bash
|
||||
docker-compose stop
|
||||
```
|
||||
|
||||
Reset the project:
|
||||
|
||||
> ⚠️ **This will also remove any related data.**
|
||||
|
||||
```bash
|
||||
docker-compose down -v --remove-orphans
|
||||
````
|
||||
|
||||
Enter the Netbox shell, e.g. to get access to `./manage.py`:
|
||||
|
||||
```
|
||||
docker-compose exec netbox /bin/bash
|
||||
```
|
||||
|
||||
### Database operations
|
||||
|
||||
Access the database:
|
||||
|
||||
```bash
|
||||
docker-compose exec postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'
|
||||
```
|
||||
|
||||
Take a database backup
|
||||
|
||||
```bash
|
||||
docker-compose exec postgres sh -c 'pg_dump -cU $POSTGRES_USER $POSTGRES_DB' | gzip > db_dump.sql.gz`
|
||||
```
|
||||
|
||||
Restore that database:
|
||||
|
||||
```bash
|
||||
gunzip -c db_dump.sql.gz | docker exec -i $(docker-compose ps -q postgres) sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'
|
||||
```
|
||||
|
||||
### Nginx doesn't start
|
||||
|
||||
|
Reference in New Issue
Block a user