• 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
  [SOLVED] netPI with Raspbian Desktop firefly 7 48 May-17th-2019, 09:15 AM
Last Post: Armin@netPI
  New Container example "OPC UA server" Armin@netPI 0 15 April-12th-2019, 11:51 AM
Last Post: Armin@netPI
  [INFO]Docker DNS server Armin@netPI 0 19 March-7th-2019, 09:02 AM
Last Post: Armin@netPI
  [SOLVED] Use netPi as a FTP server martech 1 105 October-18th-2018, 09:07 AM
Last Post: Armin@netPI
  [SOLVED] MySQL Container / Server in another Container? paubau 2 156 September-5th-2018, 08:00 AM
Last Post: paubau
  [SOLVED] USB Serial device mapping into Container hannes 12 592 August-27th-2018, 04:50 PM
Last Post: Armin@netPI
  Create own trusted Docker registry server Armin@netPI 0 107 January-27th-2018, 02:55 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)