# Deploying mappDatabase in container

**URL:** <https://community.br-automation.com/t/deploying-mappdatabase-in-container/5791>\
**Category:** How-To & Wikis\
**Tags:** mapp-database, plc, mapp-services, toolkit\
**Created:** [February 10, 2025, 11:23am UTC](https://community.br-automation.com/t/deploying-mappdatabase-in-container/5791 "2025-02-10T11:23:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomas.miculka](https://avatars.discourse-cdn.com/v4/letter/t/FF8800/32.png) [@tomas.miculka](https://community.br-automation.com/u/tomas.miculka)\
**Post date:** [February 10, 2025, 11:23am UTC](https://community.br-automation.com/t/deploying-mappdatabase-in-container/5791/1 "2025-02-10T11:23:35Z")

</div>

Hello,  
if you didint want to install python and all dependencies to use mappDatabase script. I created conterized version. So if you have docker or podman, you can deploy it with i few commands. Tested on Debian 12 and Suse 12.

Available container tags **`:6_0`, `:5_12`, `:latest`**

### 1. Podman/Docker

One of these platform must be installed on you system.  
[podman install guide](https://podman.io/docs/installation)  
[docker install guide](https://docs.docker.com/engine/install/)

After instalation make sure you allow forwarding betwwen LAN and podman/docker network  
Debian 12:

```bash
sudo ufw default allow FORWARD

```

Make sure docker/podman is running. If not you need to start it.

```bash
systemctl enable docker 
systemctl start docker

```

  

### 2 Pull image

Docker hub page: [dokcer hub](https://hub.docker.com/r/th0masis/mappdatabase)

- As root run ` docker pull th0masis/mappdatabase:tag`

## 3. Run only mappConnector

mappDatabase port must be expose, becouse we want to cominicate with plc.

If database is on same machine as docker container, you dont need to expose mysql port (3306)

```bash
podman run --restar=always --name mappdatabase-01 -d -p 85:85 -e DB_TYPE=mysql -e POLL_INTERVAL=60 th0masis/mappdatabase:5_12

```

```bash
docker run --restar=always --name mappdatabase-01 -d -p 86:85 -e DB_TYPE=mysql -e POLL_INTERVAL=60 th0masis/mappdatabase:5_12

```

  

If database is on remote machine you need to expose port for container (-p 3306:3306)

```bash
podman run --restar=always --name mappdatabase-01 -d -p 85:85 -p 3306:3306 -e DB_HOST=192.168.1.123 -e DB_TYPE=mysql -e POLL_INTERVAL=60 th0masis/mappdatabase:5_12

```

Example mappDatabase for AS 6:

```bash
docker run --name mappdatabase-01 --restar=always -d -p 55002:85 -e DB_HOST=<ip-where-is-database> -e POLL_INTERVAL=20 th0masis/mappdatabase:6_0

```

| Variable | Default Value | Description |
| --- | --- | --- |
| APP\_PORT | 85 | The port for mappdatabase in PLC |
| DB\_HOST | localhost | Hostname or IP address of the database server. |
| DB\_PORT | 3306 | Port of the database server |
| DB\_TYPE | mysql | type of the database (mysql ,mssql or postgress) |
| POOL\_INTERVAL | 60 | Interval in seconds for polling the database |

## 4. Steps after complete deploy

- check if forwarding between LAN and podman network is working
- check firewall rules
- check if systemd service is working if you use it

## 5. How to get status of container

logs:  
`docker logs mappdatabase-01 `

List of cintainers:

```auto
docker ps
docker ps -a

```

---

<div class="post-metadata">

**Author:** ![kovarj](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/kovarj/32/537_2.png) [@kovarj](https://community.br-automation.com/u/kovarj)\
**Post date:** [February 10, 2025, 12:34pm UTC](https://community.br-automation.com/t/deploying-mappdatabase-in-container/5791/2 "2025-02-10T12:34:21Z")

</div>

Thanks for sharing, @tomas.miculka! This is something I will definitely try 🙂
