# How install MQTT plugin in container

**URL:** <https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217>\
**Category:** Installation\
**Tags:** datasource, mqtt, docker, edge\
**Created:** [March 30, 2022, 9:03pm UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217 "2022-03-30T21:03:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![patopat](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@patopat](https://community.grafana.com/u/patopat)\
**Post date:** [March 30, 2022, 9:03pm UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/1 "2022-03-30T21:03:24Z")

</div>

Hi,

I try to install MQTT-datasource from [GitHub - grafana/mqtt-datasource: MQTT Datasource for Grafana allows streaming data from any MQTT broker running either locally or remotely.](https://github.com/grafana/mqtt-datasource) in a Docker container. I use Docker Desktop for windows.  
I followed the guide to compile the plug-in on windows. But now I don’t know how to install the plugin in the container.  
Can anyone help ?

Best regards,  
Pat

---

<div class="post-metadata">

**Author:** ![antonio79](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@antonio79](https://community.grafana.com/u/antonio79)\
**Post date:** [March 31, 2022, 1:30am UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/2 "2022-03-31T01:30:17Z")

</div>

If using this in a docker/container is anything like using it in a Linux environment, move the compiled plug in to the folder

/var/lib/grafana/plugins

update the /etc/grafana/grafana.ini

```auto
# Enter a comma-separated list of plugin identifiers to identify plugins to load even if they are unsigned. Plugins with modified signatures are never loade>
allow_loading_unsigned_plugins = grafana-mqtt-datasource

```

restart the server, and should work when you try to add data source in Grafana.

---

<div class="post-metadata">

**Author:** ![patopat](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@patopat](https://community.grafana.com/u/patopat)\
**Post date:** [March 31, 2022, 5:07am UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/3 "2022-03-31T05:07:35Z")

</div>

Hi @antonio79,

Thanks for your answer.

Do you know if I can compile on windows then copy the plugin in the right place or I have to compile on Linux because the container is like-Linux (Official Alpine image) ?

Do you know how copy the folder in the Grafana plugin folder in the container ?

Best regards,  
Pat

---

<div class="post-metadata">

**Author:** ![atifshoukatali](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/atifshoukatali/32/19328_2.png) [@atifshoukatali](https://community.grafana.com/u/atifshoukatali)\
**Post date:** [March 31, 2022, 10:32am UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/4 "2022-03-31T10:32:38Z")

</div>

if for the backend you use the command `mage buildAll` it will cross build the backend - so when you copy the plugin dist to a different platform it will work - you can use `docker cp` ([docker cp | Docker Documentation](https://docs.docker.com/engine/reference/commandline/cp/)) to do the copying - another option would be to just mount the folder to your container - just my 2 cents

---

<div class="post-metadata">

**Author:** ![patopat](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@patopat](https://community.grafana.com/u/patopat)\
**Post date:** [March 31, 2022, 11:27am UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/5 "2022-03-31T11:27:39Z")

</div>

Hi @atifshoukatali

I executed mage build all with success.

Regarding the folder mounting in the container, I have the following error message :Error: ✗ Plugin not found (Grafana v8.4.4 linux-amd64).

Here is my docker-compose file :

```auto
  grafana:
    image: grafana/grafana:8.4.4
    container_name: grafana-server
    restart: always
    depends_on:
      - influxdb
    environment:
      - GF_SECURITY_ADMIN_USER=yyyyy
      - GF_SECURITY_ADMIN_PASSWORD=yyyyy
      - GF_INSTALL_PLUGINS=grafana-mqtt-datasource
      - GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-mqtt-datasource
    links:
      - influxdb
    ports:
      - 3000:3000
    volumes:
      - ./grafana-plugins:/var/lib/grafana/plugins
      - grafana_data:/var/lib/grafana    
    networks:
      - influxdb_network 
      
volumes:
  grafana_data: {}
  
networks:
  influxdb_network: 

```

Do you have an idea why the plugin is not found ?

Best regards,  
Pat

---

<div class="post-metadata">

**Author:** ![atifshoukatali](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/atifshoukatali/32/19328_2.png) [@atifshoukatali](https://community.grafana.com/u/atifshoukatali)\
**Post date:** [March 31, 2022, 11:40am UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/6 "2022-03-31T11:40:14Z")

</div>

dir permissions maybe? 🤔

---

<div class="post-metadata">

**Author:** ![patopat](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@patopat](https://community.grafana.com/u/patopat)\
**Post date:** [March 31, 2022, 12:03pm UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/7 "2022-03-31T12:03:09Z")

</div>

@atifshoukatali

Do you know or know someone that can help to set permission ?  
It’s probably right, because I need to mount a local folder on Windows to container in Linux…

Pat

---

<div class="post-metadata">

**Author:** ![atifshoukatali](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/atifshoukatali/32/19328_2.png) [@atifshoukatali](https://community.grafana.com/u/atifshoukatali)\
**Post date:** [March 31, 2022, 12:36pm UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/8 "2022-03-31T12:36:54Z")

</div>

wait - on a second look - is this a windows host trying to mount on a linux container?  
in that case maybe the path is the issue - try to use an absolute path on the src side of the colon

---

<div class="post-metadata">

**Author:** ![patopat](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@patopat](https://community.grafana.com/u/patopat)\
**Post date:** [March 31, 2022, 12:48pm UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/9 "2022-03-31T12:48:59Z")

</div>

@atifshoukatali

I got it !!  
I copied the MQTT plugin in the local folder “grafana\_plugins” on my Windows host and also mounted the “/var/lib/grafana” on my host

```auto
version: "3.8"

services:

  grafana:
    image: grafana/grafana:8.4.4
    container_name: grafana-server
    restart: always
    environment:
      - GF_SECURITY_ADMIN_USER=yyyyy
      - GF_SECURITY_ADMIN_PASSWORD=yyyyy
      - GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-mqtt-datasource
    ports:
      - 3000:3000
    volumes:
      - ./grafana_plugins:/var/lib/grafana/plugins
      - ./grafana_data:/var/lib/grafana
    networks:
      - grafana_network
      
volumes:
  
networks:
  grafana_network: 

```

Pat

---

<div class="post-metadata">

**Author:** ![rmeyerredwood](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rmeyerredwood](https://community.grafana.com/u/rmeyerredwood)\
**Post date:** [September 30, 2022, 12:35am UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/11 "2022-09-30T00:35:41Z")

</div>

@patopat I want to kiss you bro. Every single solution says to just add the `allow_loading_unsigned_plugins = grafana-mqtt-datasource` line and it was good. But I guess none of those solutions were running in a docker container. I had to follow your exact instructions, ie include the environment + the volume, and FINALLY it worked.  
Thank you. It was a huge pain in the ass just to build the damn thing. It was driving me crazy to feel like I was so close yet still couldn’t get it to load.

---

<div class="post-metadata">

**Author:** ![grant2](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/grant2/32/42281_2.png) [@grant2](https://community.grafana.com/u/grant2)\
**Post date:** [September 30, 2022, 12:46am UTC](https://community.grafana.com/t/how-install-mqtt-plugin-in-container/63217/12 "2022-09-30T00:46:05Z")

</div>

Enjoy the MQTT plugin. It’s great!
