# How to Set Up a Docker Container (Beginner)

Source: https://help.sendent.com/sendent-nextcloud-workspace/nextcloud-for-ms-teams/how-to-set-up-a-docker-container-beginner

Welcome to this guide on setting up the Sendent for MS Teams Docker container on a Linux system. We'll be using Ubuntu 24 (LTS) for this guide.

**As a prerequisite**, you need to set up a valid DNS record that points to your Ubuntu installation. Before starting, add a DNS A-record that directs your custom domain to the public IP of your Ubuntu installation. In this guide, we will use the IP '0.0.0.0' for our Ubuntu installation and the A-record 'msteams.sendent.dev'.

## **Installation**

### **1. Update packages**

First, we'll begin by updating the dependencies in your Ubuntu installation. Please follow any prompts that appear after running the following two commands.

`apt-get update` (fetch latest)

`apt-get upgrade` (download and install)

Depending on the available updates, some follow-up dialogs might appear. The guide does not cover this.

### **2. Install NGINX**

We use NGINX as the reverse proxy, this will allow the Ubuntu installation to bind itself to the necessary docker port.

`apt-get install nginx`

### **3. Install Docker**

With the following command, Docker will be downloaded and automatically installed on the Ubuntu machine.

`curl -fsSL https://get.docker.com | sudo sh`

### **4. Setting up Sendent for MS Teams**

Mount the `./usr` directory.

Create a new directory in `usr` named `sendent-msteams`.

Create a new text-file, using nano `nano docker-compose.yml`. See the reference table below, with the exception of `DEFAULT_NEXTCLOUD_URL` and `PROXY_ALLOWLIST`, all variables are required for the container to start.

```yaml
version: '3.9'
services:
  sendent.msteams:
    image: rg.nl-ams.scw.cloud/sendent-public/sendent-msteams:latest
    build:
      context: ../
      dockerfile: ./Dockerfile
    restart: on-failure
	environment:
      - BASE_URL=<YOURDOMAIN>
      - MSAPP_TYPE=
	  - MSAPP_ID=
	  - MSAPP_PASSWORD=
	  - MSAPP_TENANT_ID=
	  - DEFAULT_NEXTCLOUD_URL=<YOURNEXTCLOUDDOMAIN>
      - PROXY_ALLOWLIST=<YOURNEXTCLOUDDOMAIN>
    ports:
      - "4200:4200"
    volumes:
      - ./docker-config:/usr/src/app/docker-config
    networks:
      - node_network
networks:
  node_network:
```

The following table explains the environment variables.

| **Name** | **Description** | **Example** |
|---|---|---|
| BASE\_URL | This should be the FQDN referencing to your publicly available docker image through reverse proxy. | https://msteams.sendent.dev |
| MSAPP\_TYPE | Default: SingleTenant | SingleTenant |
| MSAPP\_ID | This is the Azure Bot’s app-id. | 20d67bc1-6f95-4c2d-a49c-e8463163e30d |
| MSAPP\_PASSWORD | This is the Azure Bot’s password | Example\_password\_123! |
| MSAPP\_TENANT\_ID | Your Azure Tenant ID | 92785bec-a2fa-434b-9105-9325e5cb721c |
| DEFAULT\_NEXTCLOUD\_URL | Your Nextcloud server FQDN. | https://nextcloud.sendent.dev |
| PROXY\_ALLOWLIST | The Nextcloud servers the container may forward requests to, separated by commas. Optional: if empty, only the `DEFAULT_NEXTCLOUD_URL` server is allowed. | nextcloud.sendent.dev |

**Proxy allowlist.** From version 3.0.0, the container only forwards requests to the Nextcloud servers in `PROXY_ALLOWLIST`. If you leave it out, it allows only the server in `DEFAULT_NEXTCLOUD_URL`. If neither is set, the container forwards to any server and warns about this in its log. We do not recommend that in production. Read more in [How to configure the proxy allowlist](https://help.sendent.com/nextcloud-for-ms-teams/how-to-configure-the-proxy-allowlist).



Save and close the file. `Ctrl + X`, `Y` and hit `Enter`.

From the same directory, now do: `docker compose up -d`.

This will download and start the Sendent for MS Teams docker container.

### **5. Configure NGINX**

#### **5.1. Configuring Site**

After installation, navigate to the following folder:

`./etc/nginx/sites-enabled`

We will use 'nano' a text-editor to modify the config. If it's not there, we will automatically create it. Replace `<YOURDOMAIN>` with the domain you reserved for this service. For example: `<YOURDOMAIN>` could be replaced with `msteams.sendent.dev`.

`nano <YOURDOMAIN>.conf`

Copy and paste the following. You can paste it in nano with right mouse click.

Notice, modify the `server_name` that it reflects your own domain.

```json
server {
    listen 80;
    server_name <YOURDOMAIN>;

    location / {
        proxy_pass http://127.0.0.1:4200;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
```

You can close and save nano by `ctrl + x` and when asked to save `Y` and hit enter.

Verify the NGINX config with `nginx -t`. There should be no errors.

#### **5.2. Modifying default NGINX configuration**

Next step is modifying the nginx configuration, so large files can be uploaded.

`nano /etc/nginx/nginx.conf`

You will notice there's a HTTP element add, the following line there.

`client_max_body_size 250M;` (the maximum file size will be 250MB with upload, you can increase this though).

![](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/mceclip0_1730708557.png)

*Example client\_max\_body\_size.*

You can close and save nano by `ctrl + x` and when asked to save `Y` and hit enter.

Verify the NGINX config with `nginx -t`. There should be no errors.

Now let's reload NGINX by doing `systemctl reload nginx`.

### **6. Installing Let's Encrypt.**

Within this guide we use the free Let's Encrypt service to enable a safe SSL connection. Let's encrypt will automatically configure our NGINX configuration further.

`apt install certbot python3-certbot-nginx`

After installation restart NGINX with systemctl reload nginx

Then we're going to generate the SSL certificates with the following command, notice replace `<DOMAIN>` with your own.

`certbot --nginx -d <DOMAIN>`

Example:

`certbot --nginx -d msteams.sendent.dev`

It will ask to enter your email, to agree with their (Let's Encrypt) Terms and Conditions.

### **7. Enabling the firewall**

NOTE: Please double check if you whitelisted ALL necessary ports. The following section is recommended, but should be double checked on your own installation.

`ufw allow 'Nginx Full'` (allow port 80 and 443)

`ufw allow 'OpenSSH'` (allow port 22 ssh)

Warning, if not all the right ports are allowed, you might lose connection to the server or other services may get disrupted. Double check this.



`ufw enable` (enable firewall)

### **8. Verify**

If all went well, you can now access the manifest file that is hosted on your own server. You can do this for example by navigating in your browser to:

`https://<YOURDOMAIN>/manifest.json`

Example:

`https://msteams.sendent.dev/manifest.json`

The response should start with:

![](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/mceclip0_1724337159.png)

Example response.

## Updates

In your usr directory, where the docker compose file is located run these commands, to update to the latest version for Sendent for MS Teams.

```plaintext
# Pull the latest images
docker compose pull

# Stop the running containers
docker compose down

# Remove old containers
docker compose rm -f

# Start the containers with the updated images
docker compose up -d
```

#### Updating to 3.0.0

Before you update:

- **Allow your Nextcloud servers.** The container now only forwards requests to the servers in `PROXY_ALLOWLIST`, or to the `DEFAULT_NEXTCLOUD_URL` server if that is not set. Add every Nextcloud server your users sign in to. Otherwise their sign-in fails with "Forbidden: Target URL is not in the allowlist".

After you update:

- **Upload the new app package.** Version 3.0.0 renames the app to Nextcloud for MS Teams and comes with new icons. Your current app keeps working, but users only see the new name and icons after you upload the new package. Build it as described in [How to download and modify your manifest.json file](https://help.sendent.com/nextcloud-for-ms-teams/how-to-download-and-modify-your-manifest-json-file), then upload it as in [How to install Nextcloud for MS Teams at organization level](https://help.sendent.com/nextcloud-for-ms-teams/how-to-install-nextcloud-for-ms-teams-at-organization-level). Its version is 3.0.0, so Teams accepts it as an update.
