Emulating Raspberry Pi with Docker on OS X - docker

I've been doing a lot of Raspberry Pi work, but that means I have to carry about my Pi (or SSH home), and well, the Pi isn't the fastest in the world. I've been using Docker for running things like Postgres, and was thinking it would be awesome to just download a Docker image of the ARM build of Debian Jessie, and have everything function as if it was actually running in a real rPi. Even better if I could just somehow then quickly mirror this to an SD card and throw it into a real rPi.
Has anyone explored this? Everything I'm finding is about running Docker on the rPi, not running Docker to emulate an rPi.

Based on the answers and comments to similar questions - such as this one on the Raspberry Pi Stack Exchange site I think that the short answer to "no" (or at least not without a lot of effort)
Your problem is that as mentioned in the comments Docker doesn't do full-on virtualisation (that's kind of the point of it) so you can't get an ARM Raspbian Docker image and run it on an x86 Virtualbox host - which is what it sounds like you'd like to do.
The Docker image needs to be built for the same architecture as the host system. you get the same problem if you try to run x86 Docker images on the Raspberry Pi if it is acting as a Docker host.
By way of a solution - what I'd suggest is running a Debian VM on your Mac. Raspbian is close enough to Debian that you'll have a fairly "Pi-like" environment to develop in and can copy your code to an SD card when you're done.
If you want an easy way to manage the configuration so that the number of cores, RAM, disk space etc matches your Pi, then Vagrant may be a good solution.

Related

If the docker updates its linux kernel, does it break the existing docker images?

I am very new to docker. I have installed docker desktop on my mac. When i execute docker version it is showing OS/Arch:linux/amd64 under server docker engine. I am assuming this means that docker installed linux kernel on top of my mac OS using hypervisor to manage linux based containers. if this linux kernel got updated, will it going break the functionalities of existing images?
Why am I asking this question?
Recently after updating my mac OS to 10.15.2, things started breaking because of openssl and ruby-2.3.x compatibility issues. And I was told, we could solve these type of issues using docker since it is independent of host OS?
But docker itself has own linux kernel, Will i be going to face this issue if linux kernel got updated?
Thanks in advance
You got those errors because you were depending software libraries available on the machine. They are not related to kernel. Any such software dependencies should be bundled with the docker image. Linux kernel upgrades never break user space.

Cannot start container: [8] System error: exec format error

I'm brand new to Stack Overflow and the world of containers, so hopefully my questions aren't too silly.
So first I will say that I'm aware that there are other questions similar to the one I'm asking, but I've tried the solutions in all of the ones I've found and they haven't worked for me. If there is another question out there that does have the answer, I'm really sorry for double-asking!
So, background info: I've got a Raspberry Pi 3 running Raspbian, with docker freshly installed. I'm able to pull images down from repositories with no real issues. However, I can't run any of them. I always get the same error (the title of my question). Someone pointed out that it might be because there are mostly 64-bit images in the repositories and I'm running a 32-bit machine, which I thought was the problem. but then I pulled a 32-bit Debian image (the first thing I could find that was 32-bit) and tried to do docker run with the image ID. but it still comes up with that error.
What else may cause that error? Or maybe it's the fact that I'm doing it on a Pi...? Open to anything!
Thanks in advance!
I have had similar issues when I tried to run Docker images on Rasperri Pi. Most of the Docker images are built for x86/x64 architecture. You need Docker-based apps packaged specifically for ARM to run on Raspberry Pi. Hypriot (Based on Debian) is one of the Raspberry Pi images that built for running latest Docker. Check it out here. They also have images specifically built for ARM. Search for hypriot on docker hub.You still may run these images with your current Docker installation, which I did not try.

Docker on embedded systems, why not?

There was a project thrown my way recently that involves the orchestration of several (Linux capable) embedded devices, deploying software to them, and allowing for the applications to be updated when the code base updates in a git repo.
The initial thought was to make a standard image for each device, and I set out, attempting to install docker on an UDOO Quad and an Intel Edison to start, but without any success up to this point.
My thinking is that it seems to be a good idea to install Docker on embedded devices--but if that's the case, surely it would have been ported by now. The only group out there that seems to be making these efforts is Resin.io.
Is there something I'm missing, or is there a clear reason why Docker doesn't make sense on embedded devices? If there isn't a reason, and it does make sense to run Docker on embedded systems, is there something I've overlooked out there: are there any sources of discussion on porting, or how-to's that cover this?
I have considered running docker on embedded devices (a mips system), but didn't go that way. There are some problems with it, in my humble view:
Docker is implemented in Golang. There is currently no available tool chain for mips to compile go. You will need to create the tool chain yourself using gcc-go.
The size of docker is larger than lxc. In a desktop computer this is not a problem, but the embedded device has limited flash storage.
Docker uses some quite up-to-date feature of linux kernel. Sometimes the kernel version on embedded devices are not so new and back-port is needed to make it work.
The docker image has to be built on the same architecture as the run time environment. It means that if you want to run a docker container on Raspberry Pi, the docker image has to be built on an ARM-architecture system. QEMU can be used to build docker image in the cloud, but it doesn't support all CPU architectures used in embedded system. (for example, it currently doesn't support MIPS)
In the end, lxc was chosen for the specific task of running a container on embedded device. It has limited features compared to docker, but currently it suits the requirement of the project.
As of year 2019, I would like to update this answer since I did port docker to embedded system with ARM cpu. With the price of flash usage, memory usage, by using docker you will have container management, image management, and many ready to run images from docker hub. So the decision is a balance between cost and features.
Here is an update for 2018:
You can work with Docker on embedded devices such as Raspberry Pi and Orange Pi quite easily now because of advancements in the development of Raspbian and Armbian operating system images. Specifically, both types of devices and their respective OS images now support kernels that are of sufficiently high enough versions to install Docker without any problems (at least version 3.10, though both now offer 4.x+ versions).
Your desire for faster rates of change can definitely be realized by using embedded Docker. I can say from experience that I have tested and regularly run the approach you describe. Basically, you start with a base operating system image such as Raspbian or Armbian, tweak that operating system enough that it's secure and has Docker installed, and then you use Docker for handling development iteration and application updates.
As an aside, if you are interested in running Docker on embedded Linux devices, then I recommend you check out a free, open-source, MIT-licensed command line tool I wrote to help developers work with embedded Docker on multiple devices at once: https://github.com/ForwardLoopLLC/floopcli .
Even if you are not interested in the tool itself, the documentation for the tool describes several patterns for working with Dockerized applications across multiple devices in multiple languages: https://docs.forward-loop.com/floopcli/master/index.html . The materials there should serve as a starting point for porting applications to Docker and then deploying them on embedded devices. The documentation also addresses some embedded device subtleties, such as differences between ARMv6 and ARMv7. Hopefully this helps you get started!
There is a great article on LinkedIn describing his experience with that
https://www.linkedin.com/pulse/whale-jar-when-running-docker-embedded-linux-good-thing-fletcher#pulse-comments-urn:li:article:7736487387895237975
Often embedded systems have a very slow rate of change. Docker works well on a minimum build then layering on top. If you want to sacrifice the overhead of running docker on a minimum embedded system for docker's ability to have a build system and steady rate of change then you could explorer it.

Getting Docker to recognize nvidia graphics card on mac

When I am in my container, I run
lspci | grep -i nvidia
and nothing shows.
When I run ./deviceQuery from the samples NVIDIA provides I get
no CUDA-capable device is detected
I know I have a nvidia driver on my mac. I just can't figure out how to get my docker container to realize that.
On OS X, docker is a container running inside a separate virtualbox vm which does not expose the host GPU.
You'll first need to make the graphics card available in the Virtual Box VM. I'm not sure how to do that, but this looks like it might help:
https://www.virtualbox.org/manual/ch04.html#guestadd-video
Once you've got it mounted within the VM, then you can also share it with the container.
I haven't tried this myself, but this guy says that he can run native X11 Apps on a Mac using a beta docker client called Kinematic along with socat, XQuartz, and QGIS, and he seems to imply that NVidia driver issues were thus avoided. This looks worth a try!

Creating docker container with HP UX and IBM AIX

Can i create a docker container with HP UX and IBM AIX, if so please let me know how to do it?
I tried by creating container from HP UX tar, it got created and i got conatiner id but unable to login in to the container.
Let me know where i am doing wrong.
If you look in the FAQ https://docs.docker.com/faq/ you will see as supported
Ubuntu 12.04, 13.04 et al
Fedora 19/20+
RHEL 6.5+
Centos 6+
Gentoo
ArchLinux
openSUSE 12.3+
CRUX 3.0+
This github issue is closed at the moment https://github.com/docker/docker/issues/3546 but that could change. What you try to do is not supposed to work at the moment (which says nothing about the technical possibility)
The IBM developerWorks site has a guide on how to do this, I'm currently doing similar work on Z at the moment.
Docker on POWER at developerWorks
No. It is impossible to build AIX and HP-UX docker containers because the AIX and HP-UX are totally different operation systems with differently build closed SystemV kernels running only on RISC based CPU's compared to the wide spread Linux distributions running on almost everything.
If you have applications that only runs on AIX or HP-UX but you want them in a container, AIX has the option of using Workload Partitions, which is almost comparable with containerization.

Resources