Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. goodman7499
  2. Container @ PLCnext (Docker, Moby, balena)
  3. Monday, 03 May 2021
Hello PLCnext Community,

I'm having a little problem with my Docker running NodeRed. The thing is that one of the nodes that I'm using in NodeRed is designed to connect to the Google Cloud Platform and it requires an environment variable to be set with the name of the project. I tried following the documentation given by Docker to set an environment variable during the docker run command (https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file) but even with these the node still gives the same problem, and when trying to show the environment variables of the container, the variable set through the run command doesn't show.

With my laptop also running NodeRed, I've solved this problem by adding a line with the environment variable to be set in the settings.js file but I couldn't find any file similar to this one in the PLCnext, I guess that is because it is installed with the Docker.

I would appreciate it if anyone knows how to set the environment variables for the docker or if there exists any workaround like the one I used on my laptop.

You can find an image with the start of the container and the environment variables found. The environment variable I want to set is GOOGLE_CLOUD_PROJECT=TFGplcnext

Thank you very much in advance,
Kind regards

Guzman
Attachments (1)
jan.mueller@phoenixcontact.de Accepted Answer Pending Moderation
0
Votes
Undo
Hey,

with the command

docker exec -it <container_id> sh

you can jump to the console in the container and make the necessary changes and try them out. The changes are only temporary and can be lost. To persist the changes, you need to transfer the corresponding files to a volume.

docker run -v volume_name:/path_to_docker_dir

Important, if you do not use a volume, but a mount, e.g:

docker run -v /path_to_host:/path_to_docker_dir

you have to recreate the files from the path /path_to_docker_dir, because the host system is leading, and the folder from the host "overwrites" the one in the container.
jan.mueller@phoenixcontact.de Accepted Answer Pending Moderation
0
Votes
Undo
I have following try out:
docker run -d -e "TEST=test" nodered/node-red
Untitled.png

Can you alternatively set the env over a flow?
https://nodered.org/docs/user-guide/environment-variables#setting-a-node-property
Attachments (1)
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.