Docker for iPad

Wherever I search, I can't find any resources on how to run Docker on an iOS device.

Is iOS a valid host OS for Docker?


Solution 1:

Docker is an automation tool, which facilitates deployment of applications using Linux feature called Linux Containers. Docker provides neither virtualization nor emulation environments. As of today, running Docker containers requires using Linux (support for other operating systems, like Oracle Solaris and Windows Server is in the development phase).

Docker for Mac and Docker for Windows are separate products that run a Linux virtual machine inside the host OS and provision containers inside that machine.

There is no way of running a Linux virtual machine in iOS, hence iOS cannot be a "host for Docker".

Besides operating system, even if you ran Linux on iOS, you would need to also consider the CPU (that is also true for Raspberry Pi recommended in the comments under the other answer). Most available Docker images use binary packages for Intel/AMD architecture, not ARM limiting the use cases compared to running it on MacBook.

Solution 2:

Actually, you can run Linux on iOS and therefore you can run Docker. There's an app called UTM that I've recently been working with and have been quite surprised by what I've been able to do on my iPad Pro 11 2nd Gen.

The app does NOT require jailbreaking. In iOS 11-13, it just needs to be side-loaded since it isn't an appstore app (not surprising). On iOS 14, Apple patched the trick that was used to get JIT working. As a result, the next best workaround is significantly more involved. You can find those instructions here. But even then, you still do not need to jailbreak the device. As to why it isn't just in the appstore, according to the developers of UTM:

Apple does not permit any apps that have interpreted or generated code therefore it is unlikely that UTM will ever be allowed. However, there are various ways people on the internet have come up to sideload apps without requiring a jailbreak. We do not condone or support any of these methods.

This is just doing the exact same thing that Docker Desktop does for multi-arch images for Windows and Mac OS - utilizing LinuxKit, buildx and qemu. It is Open Source, however, so you can view the code to ensure it's safe and build out the app yourself. The site for the app is getutm.app. The source is on GitHub in utmapp/UTM.

The readme in the repository as well as the info on the site are detailed and easy to follow. There are multiple prebuilt VMs available here for several different Linux versions:

  • Arch Linux ARM
  • Debian 10.4 (osy's developer edition) ARM
  • Debian 10.4 (LDXE) ARM
  • Debian 10.4 (Xfce) ARM
  • Debian 10.4 (minimal) ARM
  • Ubuntu 14.04
  • Ubuntu 18.04

There are also prebuilt images for Android(v2.2, v4.4 and v9.0) as well as ReactOS(v0.4.14), but this is specific to Docker, so the Linux versions are what I'm concentrating on.

Once you've installed UTM and then added your Linux machine (prebuilt or by creating your own image - details in the readme.md file in the repository above) just follow the instructions here

I assume, however, that it won't be long before there is a Docker Desktop release for iOS, as it's just a build with the XCode debugger attached (same as for MacOS). since Docker Desktop is available for Windows and Mac, however, you could just use a windows vm (Windows 10 for ARM actually runs well, considering. And it isn't just Windows RT ask over again! This is a FULL Windows 10 install that can run x86, ARM32 and ARM64 apps.) inside the UTM app running Windows 10 for ARM and the Docker Desktop for Windows and that way not only is Docket availabke within the iOS device, but you would be able too build out different images from there as well as do your docker build and deployment from inside it as well. But, if you're more comfortable on Linux, this is how you'd do it. Hopefully this will help someone.