> For the complete documentation index, see [llms.txt](https://enterprise-ua.hideez.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enterprise-ua.hideez.com/korporativnii-server-hideez/rozgortannya/onovlennya-hes/docker.md).

# Docker

### Щоб оновити сервер HES для Docker, вам потрібно:

1. Оновіть усі програми Hideez Client до 3.16.Х.&#x20;
2. Вимкніть захист даних на HES.
3. Оновіть сервер, дотримуючись інструкцій нижче.
4. Увімкніть захист даних знову (див. крок 2)

### Створіть директорію для резервного копіювання

```
$ sudo mkdir /opt/HES.old
```

Резервне копіювання бази даних (оптимально для можливого подальшого відновлення):&#x20;

* MySQL Database:

Наступна команда створить копію бази даних (dump) у файлі `db.sql` у директорії  /opt/HES.old (на хості) з контейнера з назвою `hes-mysql:`

```
$ cd /opt/HES/
$ sudo sh -c "docker exec hes-mysql /usr/bin/mysqldump -u root --password=password db > /opt/HES.old/db.sql"
```

* MS SQL Database:

Наступна команда створить резервну копію бази даних `db` у файлі `db.bak` у локальній директорії `/opt/HES/mssql/data/`:&#x20;

```
 $ cd /opt/HES/
 $ sudo docker exec -it hes-mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "C00ll_Passwrd_here"  -Q "BACKUP DATABASE [db] TO DISK = N'/var/opt/mssql/data/db.bak' WITH NOFORMAT, NOINIT, NAME = 'db-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10"
```

Замініть "C00ll\_Passwrd\_here", ввівши свій пароль, який ви вказали у файлі `/opt/HES/docker-compose.yml`.

### Зупинка контейнерів:

```
$ cd /opt/HES/
$ sudo docker compose down
```

(Оптимально) Збережіть образ HES у файл tar (для можливого подальшого відновлення):

```
$ sudo docker save -o /opt/HES.old/hes.tar hes
```

### Remove image of HES:

```
$ sudo docker rmi hes --force
```

Щоб оновити сервер до останньої версії, виконайте команди:

```
$ sudo docker build . -t hes
```

І перезапустіть контейнери:

```
$ sudo docker compose up -d
```

### Якщо щось піде не так, ви можете відновити сервер HES за допомогою таких команд:

Зупинити контейнери:

```
$ cd /opt/HES/
$ sudo docker compose down
```

Видалити образи HES:

```
$ sudo docker rmi hes --force
```

Відновити базу даних

* My SQL:

Запустити тільки контейнер MySQL:

```
$ sudo docker compose up -d hes-mysql
```

Відновити базу даних MySQL з  dump -файлу

```
$ sudo cat /opt/HES.old/db.sql | sudo docker exec -i hes-mysql /usr/bin/mysql -u root --password=password db
$ sudo docker compose down 
```

* MS SQL:

Запустіть лише контейнер MS SQL:

```
$ sudo docker compose up -d hes-mssql
```

Відновити базу даних MS SQL з bak-файлу:

```
 $ cd /opt/HES/
 $ sudo docker exec -it hes-mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "C00ll_Passwrd_here"  -Q "RESTORE DATABASE [db] FROM DISK = N'/var/opt/mssql/data/db.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"
```

Замініть "C00ll\_Passwrd\_here", ввівши свій пароль, який ви вказали у файлі `/opt/HES/docker-compose.yml`&#x20;

Відновити старий образ HES з файлу tar:

```
$ sudo docker load -i /opt/HES.old/hes.tar
```

і початкові контейнери:

```
$ sudo docker compose up -d
```

### Перевіривши, що оновлення пройшло успішно і все працює нормально, ви можете видалити копії бази даних і сервера:&#x20;

```
$ sudo rm -rf /opt/HES.old
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://enterprise-ua.hideez.com/korporativnii-server-hideez/rozgortannya/onovlennya-hes/docker.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
