• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
netPI as USB-Device-Server based on raspbian
Well Frank,

usually if you specify the privileged mode under standard Docker when starting a container then all /dev/ devices are mapped into a container. Not so with netPI's Docker cause of security reasons.

Mapping all devices would mean that also the boot drive of netPI would also get accessible and this is what we do not want, else customers could modify this drive and we would expect many non-working netPIs then. So we restricted Docker at this point.

So with netPI you will have definitively have no other chance other than to map the /dev/ttyUSBx devices manually.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

Now i have the problem to get the VirtualHere server software in autostart. I have written a small script with the following content:


#VirtualHere Server starten
/usr/sbin/vhusbdarm -b -r /var/log/vhusbd.log

When i try to add a new container with Command /usr/local/bin/ autostart.sh the container doesn't boot up.
What i am doieng wrong?
Hello Frank,

it seems you are not familiar in all details with Docker and containers and how they start.

A container always has an entrypoint ... in this entrypoint you specify a single file that Docker is calling when the container is started. This start file is running as PID 1 process in the container. If you call the vhusbdarm service as background process as you do it, the script file itself will exit and since the script file is PID 1 the complete container will be stopped by Docker cause there is no PID 1 any more.

Two possibilities:
1. run vhsubdarm not as a background serving
2. or you program a while loop at the end of your script like we did it in this example here https://github.com/Hilscher/netPI-blueto...rypoint.sh
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

You are right, I'm not very familiar with docker. So thank you for your description. I got it all working now.
Last question. Is there a way to save my customized image on a usb flash drive or something without pushing it into the docker hub?
By the way I checked for the minimal setup of the container to run virtualhere

It is not necessary

* to map /dev/console into the container
* to enable network = host
* to enable privileged mode

It is necessary

* to map ports 22 and 7575
* to map /dev/ttyUSB0
* to map /dev/bus

and of course "restart always"

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

It is not necessary to map the ports because network settings is host. Also i don't need to map the ttyUSBX devices. If all devices are connected to te netPi during boot up i have access to them.
But how can i save my image out of this netPi to duplicate it on another netPi?
Yes correct, using network = host makes mapping ports obsolete. But using the host mode has disadvantages if you want to run multiple containers of the same type at the same time. If they all use a port 1000 for example they cannot be driven in host mode. With mapping you can set one container to 1000:1000 the other to 1001:1000 and so on. So my recommendation is, if you can avoid it, then do not use host mode.

Then to your question about how to copy an image. You have to know that the concept of netPI is to be a Docker Host only. This means at the current stage, netPI can only start ready-to-use/pre-developed containers and it is no development platform. So you need a Docker registry where you can pull your ready images from for all your netPI's in use. We decided to push all our example images to Docker Hub where everybody can pull the images from. You can do the same. We use the Docker Hub public mode for free. You can create your own Registry in 5 minutes on Docker Hub too and pull you image from there on all netPIs you want to use in future.

Our examples images are based on github projects that are related to the corresponding Docker Hub repository. You can do it differently: use a standard Raspberry Pi, develop the image there and push it to Docker hub with no source code. Then you can load it from there on all your netPI's.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)


Possibly Related Threads…
Thread Author Replies Views Last Post
  missing the menu items from IO Device Configurator tad 5 157 November-20th-2020, 07:41 AM
Last Post: Armin@netPI
  netPI profinet device name WalterSchaefer 2 258 October-7th-2020, 11:10 AM
Last Post: WalterSchaefer
  Accessing a modbus device connected to RTE port from Node-RED tad 10 609 October-2nd-2020, 07:21 AM
Last Post: Armin@netPI
  DHCP server not working m-yoshikawa 20 1,287 August-27th-2020, 01:30 PM
Last Post: ioexpert
  how to pick up PROFINET data and store them to OPC UA server on Node-RED/netPI. tad 7 674 March-16th-2020, 10:21 AM
Last Post: Armin@netPI
  PM - develope OPC UA Server using the Codesys Lingyue 5 481 January-17th-2020, 11:12 AM
Last Post: Armin@netPI
  [SOLVED] netPI with Raspbian Desktop firefly 8 618 November-28th-2019, 06:01 PM
Last Post: Armin@netPI
  New Container example "OPC UA server" Armin@netPI 0 261 April-12th-2019, 11:51 AM
Last Post: Armin@netPI
  [INFO]Docker DNS server Armin@netPI 0 180 March-7th-2019, 09:02 AM
Last Post: Armin@netPI
  [SOLVED] Use netPi as a FTP server martech 1 465 October-18th-2018, 09:07 AM
Last Post: Armin@netPI

Forum Jump:

Users browsing this thread: 1 Guest(s)