# How to secure Node-Red in Docker container?

**URL:** <https://discourse.nodered.org/t/how-to-secure-node-red-in-docker-container/77249>\
**Category:** General\
**Tags:** docker\
**Created:** [4 April 2023 18:28 UTC](https://discourse.nodered.org/t/how-to-secure-node-red-in-docker-container/77249 "2023-04-04T18:28:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![agentsmith1612](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@agentsmith1612](https://discourse.nodered.org/u/agentsmith1612)\
**Post date:** [4 April 2023 18:28 UTC](https://discourse.nodered.org/t/how-to-secure-node-red-in-docker-container/77249/1 "2023-04-04T18:28:24Z")

</div>

Hello, I am running node-red in a docker container and want to make it secure in my network, in best case with user and password.  
I found a lot of "how to do..." and videos on youtube but it did not work for me because I cant access the settings.js or in other words cant find it like all the others.  
Is it because I have it in a container?

Thanks in advanced.

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [4 April 2023 18:35 UTC](https://discourse.nodered.org/t/how-to-secure-node-red-in-docker-container/77249/2 "2023-04-04T18:35:05Z")

</div>

You can run `docker exec -it YourContainerName sh` to open the command line of your docker container and edit the settings.js  
The close the terminal typel `exit`

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [4 April 2023 18:50 UTC](https://discourse.nodered.org/t/how-to-secure-node-red-in-docker-container/77249/3 "2023-04-04T18:50:59Z")

</div>

If you are using the standard node-red docker file, your settings will be on the `/data` mount that you provide to it. This is the same location as your flows.

---

<div class="post-metadata">

**Author:** ![agentsmith1612](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@agentsmith1612](https://discourse.nodered.org/u/agentsmith1612)\
**Post date:** [4 April 2023 18:56 UTC](https://discourse.nodered.org/t/how-to-secure-node-red-in-docker-container/77249/4 "2023-04-04T18:56:16Z")

</div>

I exported my flows.  
--\> deinstalled to whole container  
--\> Installed again via

```auto
sudo docker run -it -d \
    -p 1880:1880 \
    -v node_red_data:/data \
    --name=mynodered \
    --restart=always \
    nodered/node-red:latest

```

then:

```auto
sudo mkdir /var/lib/docker/volumes/node_red_data
sudo touch /var/lib/docker/volumes/node_red_data/settings.js

```

then:

```auto
sudo nano /var/lib/docker/volumes/node_red_data/settings.js

```

added:

```auto
adminAuth: {
    type: "credentials",
    users: [{
        username: "USERNAME",
        password: "PASSWORD",
        permissions: "*"
    }]
}

```

Stop and start the container

but did not work.

I have to say that the whole linux terminal stuff ist new to me.  
In windows I know there is always a constant directory path beginning with a letter like C:\Program.........  
In linux I dont find this, or I am not able to see that!?

When it comes to containers I used them before on my Synology it is much more confusing for me. There are mounts and paths and I dont know where what data will be.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [3 June 2023 18:56 UTC](https://discourse.nodered.org/t/how-to-secure-node-red-in-docker-container/77249/5 "2023-06-03T18:56:29Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
