Hilscher Community Forum
Managing netPI's Docker from remote via RESTful API for netPI versions < 1.1.4.0 - Printable Version

+- Hilscher Community Forum (https://forum.hilscher.com)
+-- Forum: netPI 3 - Docker featuring Industrial Raspberry Pi 3 platform (https://forum.hilscher.com/forum-1.html)
+--- Forum: Software (https://forum.hilscher.com/forum-5.html)
+--- Thread: Managing netPI's Docker from remote via RESTful API for netPI versions < 1.1.4.0 (/thread-309.html)



Managing netPI's Docker from remote via RESTful API for netPI versions < 1.1.4.0 - Armin@netPI - August-22nd-2018

Outdated: New flow find HERE

You all know netPI's Docker web GUI portainer.io. But most of you haven't recognized that portainer.io offers a RESTful API to take control of it from remote. All that is needed is a HTTP capable client that is addressing the API function over REST.

To make it simple to understand how it works I created a Node-RED (includes a HTTP client) based flow, that shows how to login, how to list containers, images, how to pull an image, create a container, start and stop it and ALSO how to push a container from netPI back to Dockerhub for example.

Find appended the Node-RED flow you can test yourself: Load the flow.txt file to an editor and copy its content  to the clipboard and import it with "import/clipboard" in Node-RED's the top right menu pane. It is compatible with netPI's currently used portainer version 1.12.4.


RE: Managing netPI's Docker from remote via RESTful API - BFH_SAM2 - September-6th-2018

Hey Armin

Unfortunately i can't import this flow. the box where you paste has a red frame and the import button is disabled. Might there be a copy-paste problem ?
I tried it with several node-reds and it didn't work. My own flows i can load via copy/paste. is there a possibility you could attach the flow in a *.txt-file to a post here?

thank you very much !


RE: Managing netPI's Docker from remote via RESTful API - Armin@netPI - September-6th-2018

Indeed I see the same thing happening with my Node-RED.

While my original code was working, copying it from the post didi not work.

I updated the post now and change from inline code to a text file which works well now.

Thanks for checking it.


RE: Managing netPI's Docker from remote via RESTful API - BFH_SAM2 - September-7th-2018

I was able to import the flow and play with it.

Unfortunately i have following problem when i'm trying to push the container to dockerhub.

{"message":"Pushing has been disabled due to licensing reasons"}

My container is based on the hilschernetpi/netpi-nodered-fieldbus:latest with my own changes. is this a licensing problem with the container or with dockerhub ?

I just want to backup my container before i update the netPIs software, during which all data gets lost i understand ?

thanks for your help


RE: Managing netPI's Docker from remote via RESTful API - Armin@netPI - September-7th-2018

Yes it is correct that the firmware update to for example V1.1.3.0RC3 or any other revision will clear netPI's whole file system.

Only the latest released software V1.1.3.0RC3 has the netPI internal restriction "pushing disabled" removed. I suppose you are using a softare V1.1.1.0 or V1.1.2.0. In these version pushing is disabed in netPI and the error message {"message":"Pushing has been disabled due to licensing reasons"} is generated.

This restriction was implemented during our first Docker implementations in all our "Edge/IoT Gateway" products in order not to allow a later push of loaded containers you can buy for money from the internet like for example containers from IBM. At later time we felt such a restriction is no good for developers like you which is the 99% use case. And then we removed the restriction in V1.1.3.0RC3.

I don't know whether or not you also installed SSH service into your fieldbus container extra, but if so you can login to the continer over SSH and just copy the complete folders you changed with a tool like Filezilla to you local PC disk drive and play them back after the update.

If you have started the container in network "host" mode, you can easily use the web console to install the SSH service which opens the port 22 automatically. If your container is running in "bridged" mode things are a little different. You have to make a local copy of your container on netPI as it is and then start it again with port 22 opened.