# Installation

## Quick start

#### 1. Install Docker if not present

{% embed url="<https://docs.docker.com/engine/install/>" %}

{% hint style="info" %}
Docker images can also be run with other [OCI](https://opencontainers.org/)-compatible container services, like [podman](https://podman.io/), [Buildah](https://buildah.io/), [containerd](https://containerd.io/), [LXC](https://linuxcontainers.org/lxd/introduction/) and [kaniko](https://github.com/GoogleContainerTools/kaniko).
{% endhint %}

{% hint style="info" %}
Native installations without Docker are possible, but not supported. \
Issues are not observed.
{% endhint %}

#### 2. Continue with the Beginner's Guide

{% content-ref url="guides/beginner" %}
[beginner](https://docs.datarhei.com/core/guides/beginner)
{% endcontent-ref %}

## Docker images

Select the CPU architecture and, if desired, the GPU support:

{% tabs %}
{% tab title="AMD64, ARM64, ARMv7l" %}
{% code overflow="wrap" %}

```docker
docker run {...params} datarhei/core:latest
```

{% endcode %}
{% endtab %}

{% tab title="Raspberry Pi 32/64 Bit" %}
{% hint style="info" %}
Pi 3 supports MMAL/OMX for 32 Bit (64 Bit is not supported).&#x20;

Pi4 supports V4LM2M for 32/64 Bit
{% endhint %}

```docker
docker run {...params} --privileged datarhei/core:rpi-latest
```

{% hint style="warning" %}
Hint: **raspi-config** requires **gpu\_mem=256** or more.
{% endhint %}
{% endtab %}

{% tab title="AMD64, Nvidia CUDA" %}

```docker
docker run {...params} --runtime=nvidia datarhei/core:cuda-latest
```

{% endtab %}

{% tab title="AMD64 Intel VAAPI" %}

```
docker run {...params} --volume /dev/dri:/dev/dri datarhei/core:vaapi-latest
```

{% endtab %}
{% endtabs %}

## Docker run {...params}

All default values can be changed and are described on the [Configuration ](https://docs.datarhei.com/core/broken-reference)page.

Complete example:

{% tabs %}
{% tab title="Linux/OSX" %}

```docker
docker run --detach --name core \
    --privileged \
    --security-opt seccomp=unconfined \
    --env CORE_API_AUTH_ENABLE=true \
    --env CORE_API_AUTH_USERNAME=admin \
    --env CORE_API_AUTH_PASSWORD=datarhei \
    --publish 1935:1935 \
    --publish 1936:1936 \
    --publish 6000:6000/udp \
    --publish 8080:8080 \
    --publish 8181:8181 \
    --volume ${PWD}/core/config:/core/config \
    --volume ${PWD}/core/data:/core/data \
        datarhei/core:latest
```

{% hint style="info" %}
**${PWD}** creates a folder structure in the folder where the command is issued. Please correct this if necessary.
{% endhint %}
{% endtab %}

{% tab title="Windows" %}
{% code overflow="wrap" %}

```docker
docker run --detach --name core --privileged --security-opt seccomp=unconfined --env CORE_API_AUTH_ENABLE=true --env CORE_API_AUTH_USERNAME=admin --env CORE_API_AUTH_PASSWORD=datarhei --publish 1935:1935 --publish 1936:1936 --publish 6000:6000/udp --publish 8080:8080 --publish 8181:8181 --volume %USERPROFILE%/core/config:/core/config --volume %USERPROFILE%/core/data:/core/data datarhei/core:latest
```

{% endcode %}

{% hint style="info" %}
Replace %USERPROFILE% with something like c:/myfolder
{% endhint %}
{% endtab %}
{% endtabs %}

### Directory exports

```
docker ... 
    --volume $HOST_DIR:$CORE_DIR \
    ...
```

`$HOST_DIR` can be adjusted without reconfiguring the app. For the `$CORE_DIR,` check the configuration instructions.

#### Configuration directory

```
--volume ${PWD}/core/config:/core/config
```

Directory for holding the config and operational data.

{% hint style="info" %}
**${PWD}** creates a folder structure in the folder where the command is issued. Please correct this if necessary.
{% endhint %}

#### Data directory

```
--volume ${PWD}/core/data:/core/data
```

Directory on disk, exposed on HTTP path “/“.

{% hint style="info" %}
**${PWD}** creates a folder structure in the folder where the command is issued. Please correct this if necessary.
{% endhint %}

### Port

{% tabs %}
{% tab title="Network-Isolation" %}

```
docker ... 
    --publish $HOST_PORT:$CORE_PORT \
    ...
```

`$HOST_PORT` can be adjusted without reconfiguring the app. For the `$CORE_PORT,` check the configuration instructions.

#### HTTP Port

```
--publish 8080:8080
```

HTTP listening address.

#### HTTPS Port

```
--publish 8181:8181
```

HTTPS listening address.

#### RTMP Port

```
--publish 1935:1935
```

#### RTMPS Port

```
--publish 1936:1936
```

RTMP server listen address.&#x20;

#### SRT Port (UDP)&#x20;

```
--publish 6000:6000/udp
```

SRT server listen address.&#x20;

{% hint style="info" %}
/udp is required for SRT port-mapping.
{% endhint %}
{% endtab %}

{% tab title="Host-Network (Linux)" %}

```
docker ... 
    --net=host \
    ...
```

With **--net=host** the container is started without network isolation. In this case, port forwarding is not required.
{% endtab %}
{% endtabs %}

###

### Environment variables

```
docker ... 
    --env CORE_API_AUTH_ENABLE=true \
    --env CORE_API_AUTH_USERNAME=admin \
    --env CORE_API_AUTH_PASSWORD=datarhei \
    ...
```

More in the [Configuration](https://docs.datarhei.com/core/configuration) instructions.

### Device access

```
--privileged
```

Allow FFmpeg to access GPU's, USB and other devices available in the container.

### Network issues (seccomp)

If seccomp is active and no internal-to-external communication is possible:

```
--security-opt seccomp=unconfined
```

## Docker commands

#### Start in background

```
docker run --detach --name core {params ...} {image}
```

#### Stop

```
docker stop core
```

#### Kill and remove the instance

```
docker kill core
docker rm core
```

#### Update the local image and restart the Core

```
docker pull {image}
docker kill core
docker rm core
docker run {params ...} {image}
```

#### Top

```
docker top core
```

#### Logging

```
docker logs core -f
```

##

## Systemd

To manage the Core container via systemd (systemd is a Linux process daemon.)

### Service file

{% code title="/etc/system/systemd/core.service" %}

```
[Unit]
Description=datarhei Core
After=docker.service
Requires=docker.service
 
[Service]
TimeoutStartSec=0
Restart=always
ExecStart=/usr/bin/docker run \
  --rm --name core --privileged \
  --security-opt seccomp=unconfined \
  -v /opt/core/config:/core/config \
  -v /opt/core/data:/core/data \
  -p 8080:8080 -p 8181:8181 \
  -p 1935:1935 -p 1936:1936 \
  -p 6000:6000/udp \
  datarhei/core:latest
ExecStop=/usr/bin/docker kill core

[Install]
WantedBy=multi-user.target
```

{% endcode %}

{% hint style="info" %}
Adjust the docker command options according to your setup.
{% endhint %}

### Commands

#### Install

```
systemctl daemon-reload && systemctl enable core.service
```

#### Uninstall&#x20;

```
systemctl disable core.service
```

#### Start

```
systemctl start core.service
```

#### Stop

```
systemctl stop core.service
```

#### Update image

```
docker pull datarhei/core:latest && \
systemctl restart core.service
```

#### Status

```
systemctl status core.service
```

#### Logging

```
journald -u core.service -f
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datarhei.com/core/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
