# Docker

This instruction shows how to install the IES server using docker containers on Linux. Examples of commands are given for CentOS Stream 9 and Ubuntu (20+), for other Linux versions, refer to the documentation on installing and running docker. The steps for running IES will not be different.

First of all, you need to decide what URL will be for your future IES server. It can be something like ipi.yurcompany.com. Hereinafter, this name is indicated as \<your\_domain\_name>. You can copy this instruction into any text editor and replace all instances of the \<your\_domain\_name> with your name. After that, you can execute most of the commands just copying them from the editor.

You need to add your domain name to the DNS settings of your hosting provider.

## 1. Preparation (if not already done)

### Install Docker

You can also always refer to the official installation documentation: <https://docs.docker.com/engine/install>

**CentOS**

```
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker
sudo systemctl enable docker
```

in case of unsuccessful installation, on Centos, you may need to remove some packages

```
sudo yum remove runc podman buildah -y
```

and retry the installation

**Ubuntu**

```
# Add Docker's official GPG key:
sudo apt-get update 
sudo apt-get install ca-certificates curl gnupg -y
sudo install -m 0755 -d /etc/apt/keyrings 
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update 
# Install docker
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

**To verify installed docker version run the following command:**

```
docker --version

# Docker version 27.3.1, build ce12230
```

and docker compose:

<pre><code><strong>docker compose version
</strong>
# Docker Compose version v2.29.7
</code></pre>

## 2. Іnstalling IES in the docker

### Download templates

We have prepared an archive with a template for building containers

```
cd ~
curl -O https://update.ipi.com/hes/docker_latest.tar.gz
```

### Extracting files and moving to the /opt directory and create folders for IES

```
tar -xvf docker_latest.tar.gz
sudo mv IES /opt/ 
```

### Build docker image

```
cd /opt/IES/
sudo docker build . -t hes
```

During operation, IES uses an encryption certificate that will be generated in the /opt/hes/hes-site/x509stores directory Since the server will run under the "root" user inside the container, you need to change the owner of the certificate directory:

```
sudo chown root:root /opt/IES/hes-site/x509stores
```

(optional) during the build, some space was used, then it can be cleared:

```
sudo docker builder prune --force            
```

and load the container&#x73;**:**

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

### Check the status

You can check the status of the docker containers running the command:

```
sudo docker compose ps


NAME        IMAGE     COMMAND                  SERVICE     CREATED         STATUS                        PORTS
hes-mysql   mysql     "docker-entrypoint.s…"   hes-mysql   9 minutes ago   Up About a minute (healthy)   3306/tcp, 33060/tcp
hes-nginx   nginx     "/docker-entrypoint.…"   hes-nginx   9 minutes ago   Up About a minute             0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp
hes-site    hes       "./IES.Web"              hes         9 minutes ago   Up About a minute             5000/tcp
```

To make sure that everything is configured correctly, open the URL of your site in a browser (`https://<your_domain_name>`). You should see the server authorization page. Log in using the default login 'admin\@server' and default password 'admin'.

In case you cannot log in to the IES, see log files located in '/opt/IES/hes-site/logs'

### Configure the Nginx (Optional)

Stop Server:

```
cd /opt/IES
sudo docker compose down
```

Open the `/opt/IES/nginx/nginx.conf` file for editing. Uncoment and replace all instances of \<your\_domain\_name> with your name.

Finally, when config files updated, you can run the server:

```
cd /opt/IES
sudo docker compose up -d 
```

### Configure the Docker for MS SQL (Optional)

Currently, IES can work with two databases: MySQL or MS SQL. By default, we use My SQL, but if you want to switch to MS SQL, you will need to perform a few additional steps, which will be described below

Skip this step, if you use a MySQL database<br>

Stop Server:

```
cd /opt/IES
sudo docker compose down
```

So, first you need to tweak the file `/opt/IES/docker-compose.yml`

We have prepared a templates to work with the MS SQL container. Just run next commands:

```
sudo cp /opt/IES/mssql/docker-compose.yml /opt/IES/docker-compose.yml
sudo cp /opt/IES/mssql/appsettings.Production.json /opt/IES/hes-site/appsettings.Production.json
```

You need to find the text in docker-compose.yml file

`SA_PASSWORD: C00ll_Passwrd_here`

and set your SA user password instead of 'C00ll\_Passwrd\_here'. We will later need this password to create a user and IES database

Start MS SQL container only:

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

Use the docker exec -it command for create a new database and user:

```
sudo docker exec -it hes-mssql /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P "C00ll_Passwrd_here" -No  -i /root/create_database.sql
```

instead of "C00ll\_Passwrd\_here", enter your password here, which you specified in the `/opt/IES/docker-compose.yml` file

The above command will execute the "/opt/IES/mssql/create\_database.sql" script, which you can view (and optionally modify). As a result, a user and a database will be created in the Ms Sql database. Please note that this user and database will be used by IES (in the file /opt/IES/hes-site/appsettings.Production.json)

after changing the settings, you can start the server:

```
cd /opt/IES
sudo docker compose up -d 
```

{% hint style="info" %}
[Here](/ipi-enterprise-server/deployment/hes-update/docker.md) you can find an update guide for Docker.
{% endhint %}

{% hint style="info" %}
By default, access to the new server:\
login - [admin@server<br>](mailto:admin@ipi.com)password - admin
{% endhint %}


---

# 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://enterprise-ipi-en.hideez.com/ipi-enterprise-server/deployment/hes-deployment/docker.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.
