Initial Docker page

master
Steven Honson 2021-04-06 17:57:55 +10:00
commit fe131c2b3a
1 zmienionych plików z 147 dodań i 0 usunięć

147
Docker.md 100644

@ -0,0 +1,147 @@
[![Container Images](https://github.com/projecthorus/chasemapper/actions/workflows/container.yml/badge.svg?branch=master)](https://github.com/projecthorus/chasemapper/actions/workflows/container.yml)
A pre-built Docker image is available at https://github.com/orgs/projecthorus/packages/container/package/chasemapper.
## Installation
### Docker
It is highly recommended that you use the latest version of Docker, rather than the one available from your systems default package repositories.
A quick way to install the latest version of Docker is by using the [convenience script](https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script):
```sh
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
```
To be able to run `docker` commands as your non-root user (recommended), run:
```sh
sudo usermod -aG docker $(whoami)
```
You will need to logout and log back in afterwards to pick up the changes to group membership.
### Configuring chasemapper and creating a log directory
`horusmapper.cfg` should be configured as per [the guidelines in `README.md`](https://github.com/projecthorus/chasemapper/blob/master/README.md#configuration--startup). An example `horusmapper.cfg` can be found [here](https://raw.githubusercontent.com/projecthorus/chasemapper/master/horusmapper.cfg.example).
Also ensure that an empty directory named `log_files` is available if you wish to retain log files.
A quick way to create these files, assuming you want to store them in your home directory, is:
```sh
mkdir -p ~/chasemapper/log_files
curl -o ~/chasemapper/horusmapper.cfg https://raw.githubusercontent.com/projecthorus/chasemapper/master/horusmapper.cfg.example
```
Making sure to edit `~/chasemapper/horusmapper.cfg` to your requirements.
### Running the container
```sh
docker run \
-d \
--name chasemapper \
--restart="always" \
--device=/dev/bus/usb \
--network=host \
-v ~/chasemapper/horusmapper.cfg:/opt/chasemapper/horusmapper.cfg:ro \
-v ~/chasemapper/log_files/:/opt/chasemapper/log_files/ \
ghcr.io/projecthorus/chasemapper:latest
```
Substitute `~/chasemapper/horusmapper.cfg` and `~/chasemapper/log_files/` in the above command with the relevant local paths on your Docker host if not storing these in your home directory as per the above examples.
`--restart="always"` will result in the container automatically restarting after a failure or host system reboot.
Once running, you can access the Web UI through `http://<docker-host>:5001`.
## Other useful commands
### Pulling the latest version of the container
```sh
docker pull ghcr.io/projecthorus/chasemapper:latest
```
You must then remove and recreate the container to use the newly pulled version, for example:
```sh
docker pull ghcr.io/projecthorus/chasemapper:latest
docker stop chasemapper
docker rm chasemapper
docker run -d --name chasemapper --restart="always" --device=/dev/bus/usb -v ~/chasemapper/horusmapper.cfg:/opt/chasemapper/horusmapper.cfg:ro -v ~/chasemapper/log_files/:/opt/chasemapper/log_files/ -p 5000:5000 ghcr.io/projecthorus/chasemapper:latest
```
### Restarting the container
Restarting the container is useful for picking up changes to `horusmapper.cfg`.
```sh
docker restart chasemapper
```
### Stoping the container
```sh
docker stop chasemapper
```
### Removing the container
```sh
docker rm chasemapper
```
### Viewing the containers logs
#### All logs
```sh
docker logs chasemapper
```
#### Last 50 lines
```sh
docker logs --tail 50 chasemapper
```
#### Following the logs in real-time
```sh
docker logs --tail 50 --follow chasemapper
```
### Opening a shell within an existing running container
```sh
docker exec -it chasemapper /bin/bash
```
## Docker Compose
If you wish to use Docker Compose instead of the `docker` CLI, the following basic `docker-compose.yml` can be used as a starting point:
```yaml
services:
chasemapper:
container_name: chasemapper
devices:
- /dev/bus/usb
image: ghcr.io/projecthorus/chasemapper:latest
network: host
restart: always
volumes:
- ./horusmapper.cfg:/opt/chasemapper/horusmapper.cfg:ro
- chasemapper_logs:/opt/chasemapper/log_files/
volumes:
chasemapper_logs:
```
`horusmapper.cfg` should be configured as per [the guidelines in `README.md`](https://github.com/projecthorus/chasemapper/blob/master/README.md#configuration--startup). An example `horusmapper.cfg` can be found [here](https://raw.githubusercontent.com/projecthorus/chasemapper/master/horusmapper.cfg.example).
For help getting started with Docker Compose, @mikenye's [ADS-B Reception, Decoding & Sharing with Docker](https://mikenye.gitbook.io/ads-b/setting-up-the-host-system/install-docker-compose) guide is a great resource.