• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Application developed with commercial Raspberry Pi
#5
If you have an application natively installed under Raspbian OS today then it is not possible any more to put this application in an container afterwards.

So you have to start with Docker and install it on your standard Raspberry Pi under Raspbian OS first. Then you deploy a basic container like "hilschernetpi/netpi-raspbian" on top. So it is a kind of double Raspbian OS and sounds odd in the first moment ... but with this constellation the containerized Raspbian OS is gettting portable and all the installations your made "inside" , while the native host Raspbian OS is not portable.

So I explain you the manual way WITHOUT using Dockerfile method. This is how I collected my experience with Docker by the way 4 years ago.

So install Docker on your Raspberry Pi first. Call

Code:
sudo docker run -it --privileged --network=host --name=mycontainer --entrypoint=/bin/bash hilschernetpi/netpi-raspbian

  • This command installs the hilschernetpi/netpi-raspbian Raspbian OS container (on top of your Raspberry Pi Raspbian OS).
  • This commands also "runs" the container and starts it
  • This commands names the container "mycontainer"
  • This command also calls the Linux bash terminal /bin/bash command inside this container
  • This commaned immediately "runs/jumps" into the container context and leaves the host Raspbian OS context
  • This command changes your current Raspbian OS terminal prompt to the one in the container
    ... now you are in the container Raspbian OS and not on your native host Raspbian OS any more
Continue to call ALL Linux commands as usual and make your installations as usual ... but all installations are now stored in the context of the containerized Raspbian OS. After your are finsihed with all your installations then call


Code:
exit

And then you "leave" the container context and your are back to your native host Raspbian OS.

Call the command for simple confirmation


Code:
docker ps -a

and you will see that there is container on your system named "mycontainer"

CONTAINER ID  IMAGE                         COMMAND      CREATED         STATUS                      PORTS   NAMES
7a963583225a  hilschernetpi/netpi-raspbian "/bin/bash"  10 seconds ago  Exited (127) 3 seconds ago           mycontainer


What you now can do is creating an image from your edited Raspbian OS container using the command

Code:
docker commit mycontainer myrepository/mycontainer:V1.0.0

This command now saves all the contents of your container inclusive all new data to a portable image ... and this image can run on any other machine like netPI.  Just look if the image has been created using the command


Code:
docker images

You will get an output like this


REPOSITORY                           TAG                 IMAGE ID            CREATED             SIZE
myrepository/mycontainer             V1.0.0              910c7c62ab7d        3 seconds ago       801MB

Finally you can push this image to Docker Hub for example to make it public to everyone ... and then everone can load it on his local machine ... The image must start with the repository name where you want to push the image to. In my example "myrepository" is just a sample name and needs to be replaced by you with a valid name of your Docker hub repository. After that use the command

Code:
docker push myrepository/mycontainer:V1.0.0


and the images is immediately uploaded to the Docker hub internet and everyone can grab it.

Supposing your are not satisfied with the current status of your container and you want to add more applications to it then you have to "jump" into the container again. Befor that you have to start it. Call
Code:
docker start mycontainer
docker exec -it mycontainer /bin/bash


Then you are again in the container and you can call additional Linux commands in the container. Finally use "exit" to leave again ... create and image V1.0.1 for example, and push it to your registry.

This is all the manual way and time consuming.

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

  Reply


Messages In This Thread
RE: Application developed with commercial Raspberry Pi - by Armin@netPI - June-24th-2020, 08:37 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Access to RTC from my own container application tad 1 3,632 March-19th-2021, 02:58 PM
Last Post: Armin@netPI
  netpi raspberry Hochschulstudent 1 2,405 August-12th-2020, 01:50 PM
Last Post: Armin@netPI
  CODESYS - Control for Raspberry Florian 1 3,875 March-18th-2019, 06:16 PM
Last Post: Armin@netPI
  Setup trusted Docker registry on a Raspberry Pi to host netPI containers Armin@netPI 12 12,845 January-31st-2019, 06:47 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 2 Guest(s)