﻿# Docker

> The Docker image runs the whole application (server and portal) on port 8080 as the non-root user appuser (uid 1001). It is based on the ASP.NET Core 10.0 runtime on Ubuntu 24.04 LTS, so the host needs no .NET runtime.

Source: https://workwise-solutions.net/docs/installation/docker/ · Language: en · Hungarian version: https://workwise-solutions.net/hu/docs/installation/docker/

The Docker image runs the whole application (server and portal) on port 8080 as the non-root user `appuser` (uid 1001). It is based on the ASP.NET Core 10.0 runtime on Ubuntu 24.04 LTS, so the host needs no .NET runtime.

> **Full guide.** Building the image, the run and service scripts for Linux and Windows, all settings and the troubleshooting section are in the operator guide of the [WorkSmartHub-Docker-Kubernetes](https://workwise-solutions.net/docs/installation/operator-guide/) repository ([English](https://workwise-solutions.net/docs/installation/operator-guide/), [Magyar](https://workwise-solutions.net/hu/docs/installation/operator-guide/)). This page is a summary.

![WorkSmartHub in Docker](https://workwise-solutions.net/docs/images/diagram-install-docker-en.png)
*The container listens on port 8080 behind a reverse proxy and keeps its state in the named volume at /app/data.*

## The image

There is no public registry: the image `worksmarthub:<version>` is built from the source folders with `build/build-image.sh --version <n>` (or `build-image.ps1`), or loaded on the host with `docker load -i`.

## Running it

With the scripts of the operator repository:

```bash
cd docker/linux
sh worksmarthub-run.sh --version 23 --detach
```

```powershell
cd docker\win
.\worksmarthub-run.ps1 -Version 23 -Detach
```

Without the scripts, the essential command is:

```bash
docker volume create worksmarthub-data
docker run -d --name worksmarthub --restart unless-stopped --stop-timeout 60 \
  -p 8080:8080 -e HttpSettings__Urls__0=http://+:8080 \
  --mount type=bind,source=/opt/worksmarthub/appsettings.json,target=/app/appsettings.json \
  -v worksmarthub-data:/app/data \
  worksmarthub:23
```

Then open `http://<host>:8080/`, upload the licence and create the first user ([Getting started](https://workwise-solutions.net/docs/getting-started/)).

| Option | Purpose |
|---|---|
| `-e HttpSettings__Urls__0=http://+:8080` | Listen on all interfaces on the container port. Required. |
| `-v worksmarthub-data:/app/data` | The persistent data volume. Without it, data is lost when the container is removed. |
| `--mount ... appsettings.json` | Your configuration from the host. Environment variables override it (`Section__Key`, for example `ConnectionStrings__InternalDb`). |
| `--stop-timeout 60` | Lets the application finish its background work (45 s) and close the database. |
| `--restart unless-stopped` | Restart after a crash and when Docker starts. |

To start at boot, rely on the restart policy with the Docker service enabled, or install the systemd service / Windows scheduled task of the operator repository. The container's clock is UTC, so job times in **App Konfiguráció → Háttérfolyamatok** are UTC.

## What the data volume holds

| Content | Path in the volume |
|---|---|
| SQLite database | `database.db`, `database.db-wal`, `database.db-shm` (always copy together) |
| Server disk file storage | `FileStorage/` |
| Log files | `Logs/` |
| Live e-mail and notification templates | `LiveEmailTemplates/`, `LiveNotificationTemplates/` |

`appsettings.json` is not in the volume; back it up separately. With an external database and a cloud file storage the volume holds only logs and templates.

## Before first real use

Extract `appsettings.json` from the image, set your own **signing keys** and `PublicBaseUrl`, and make the file readable only by administrators and uid 1001 ([Configuration](https://workwise-solutions.net/docs/installation/configuration/)). Behind a reverse proxy, the proxy must set `X-Forwarded-Host` and `X-Forwarded-Proto` and accept request bodies above 25 MB.

## Health check

`GET /health` answers `200 {"status":"Healthy"}` without sign-in. The image has no `HEALTHCHECK` and no curl; the operator guide shows a `bash`-based check for Docker Compose.

## Upgrade, backup, restore

Stop and remove the container, then run the new image with the same volume; migrations run at start. Back up the volume with the application stopped. The commands are on [Upgrading, backup and restore](https://workwise-solutions.net/docs/installation/upgrade-backup-restore/#docker).
