• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
netPI as USB-Device-Server based on raspbian
#21
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)

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

!/bin/bash

#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?
  Reply
#23
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)

  Reply
#24
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?
  Reply
#25
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)

  Reply
#26
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?
  Reply
#27
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)

  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  netPI opc ua server pull image error wswitula 3 3,109 August-27th-2021, 10:47 AM
Last Post: wswitula
  OPC UA server with NetPi RTE DSongra 9 4,210 July-27th-2021, 12:01 PM
Last Post: Armin@netPI
  REST API server data communication MGharat 2 2,440 July-21st-2021, 07:01 AM
Last Post: MGharat
  [SOLVED]DHCP server not working m-yoshikawa 24 13,613 June-11th-2021, 07:04 AM
Last Post: tad
  Raspbian OS version of the latest hilschernetpi/netpi-raspbian tad 2 2,257 March-5th-2021, 11:25 AM
Last Post: tad
  missing the menu items from IO Device Configurator tad 5 3,216 November-20th-2020, 07:41 AM
Last Post: Armin@netPI
  netPI profinet device name WalterSchaefer 2 2,486 October-7th-2020, 11:10 AM
Last Post: WalterSchaefer
  Accessing a modbus device connected to RTE port from Node-RED tad 10 7,903 October-2nd-2020, 07:21 AM
Last Post: Armin@netPI
  how to pick up PROFINET data and store them to OPC UA server on Node-RED/netPI. tad 7 5,566 March-16th-2020, 10:21 AM
Last Post: Armin@netPI
  PM - develope OPC UA Server using the Codesys Lingyue 5 3,990 January-17th-2020, 11:12 AM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)