UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    [How to] Run Docker on your device

    Scheduled Pinned Locked Moved Support
    9 Posts 3 Posters 2.0k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • fredldotmeF Offline
      fredldotme
      last edited by fredldotme

      Hello again!

      I've been working on bringing Docker to Ubuntu Touch, with success! Although not completely finished, I'd like to share what is possible today.

      This requires a device with snapd installed, specifically Ubuntu Touch 24.04-1.2 and up.

      This required changes to the Docker Snap, with a PR on GitHub that has received two heart reactions by the maintainers, so the chances of this PR landing upstream are high. For those interested in what was necessary: https://github.com/canonical/docker-snap/pull/327

      I've shared a preliminary build of this Docker Snap on Google Drive and my private NextCloud instance, until the PR is merged upstream. Download links are below.

      A Pull Request with automatic firewall detection has been merged upstream, so I have removed links to my private builds. Instead follow the instructions in How to to get a working Snap on your device.

      Kernel support

      For Docker to work your device's kernel requires a certain set of features enabled. I've tried to list them here: https://gist.github.com/fredldotme/5dffc8bfa410cfa8f541276407154494

      Also, if the device uses CONFIG_ANDROID_PARANOID_NETWORK in it's configuration, it might be beneficial to disable that also since otherwise containers won't be able to connect to the internet.

      How to

      1. Ensure you are running 24.04-1.2, which adds support for the Docker Snap in confined mode

      2. Install the Snap on your device: sudo snap install docker --edge

      3. Test whether Docker works: sudo docker run hello-world

      4. For running Docker without sudo, set up your user appropriately:

      sudo addgroup --extrausers docker
      sudo adduser $USER docker
      newgrp docker
      sudo snap disable docker
      sudo snap enable docker
      
      1. You're done!

      If you feel really adventurous you can now even install the Clickable Snap (sudo snap install clickable) and develop your Ubuntu Touch apps directly on your Ubuntu Touch device. How awesome is that? 🙂

      For a list of my contributions to Ubuntu Touch visit: https://fredl.me

      If you have enjoyed my work on Ubuntu Touch over the years, please donate to my causes:

      • PayPal: https://paypal.me/beidl
      • Liberapay: https://liberapay.com/fredldotme
      fredldotmeF 1 Reply Last reply Reply Quote 7
      • fredldotmeF Offline
        fredldotme @fredldotme
        last edited by

        And here a little success story on combining the Clickable Snap & the Docker Snap, allowing to build AND test a click package directly on the device (in this case a JingPad). Photo courtesy of Sander:

        photo_2025-11-05_21-28-47.jpg

        For a list of my contributions to Ubuntu Touch visit: https://fredl.me

        If you have enjoyed my work on Ubuntu Touch over the years, please donate to my causes:

        • PayPal: https://paypal.me/beidl
        • Liberapay: https://liberapay.com/fredldotme
        1 Reply Last reply Reply Quote 6
        • fredldotmeF fredldotme has marked this topic as solved on
        • fredldotmeF fredldotme marked this topic as a regular topic on
        • arubislanderA arubislander pinned this topic on
        • fredldotmeF Offline
          fredldotme
          last edited by

          Hello again.

          Some things happened since I posted the original post above. I've gone ahead and added automatic detection for xtables vs nftables to the Docker Snap, which was received quite positively by the maintainers. Here's the PR for those who are interested: https://github.com/canonical/docker-snap/pull/329

          You can install the Snap via:

          sudo snap install docker --channel=edge/pr-329

          If you've already installed the test package from the Downloads link above, you will have to instead run:

          sudo snap refresh docker --channel=edge/pr-329 --amend

          When this lands it will first land in the edge channel before promotion to a more "stable" channel, so keep that in mind once you see the PR merged.

          For a list of my contributions to Ubuntu Touch visit: https://fredl.me

          If you have enjoyed my work on Ubuntu Touch over the years, please donate to my causes:

          • PayPal: https://paypal.me/beidl
          • Liberapay: https://liberapay.com/fredldotme
          1 Reply Last reply Reply Quote 2
          • P Online
            projectmoon
            last edited by

            I tried running the Docker snap before, but I got hit by overlayfs not being present. Will your version of the snap work in that situation? Or is it dependent on the device having overlayfs?

            fredldotmeF 1 Reply Last reply Reply Quote 0
            • fredldotmeF Offline
              fredldotme @projectmoon
              last edited by

              @projectmoon overlayfs not being available is a kernel problem, for which you should contact your device maintainer.

              For a list of my contributions to Ubuntu Touch visit: https://fredl.me

              If you have enjoyed my work on Ubuntu Touch over the years, please donate to my causes:

              • PayPal: https://paypal.me/beidl
              • Liberapay: https://liberapay.com/fredldotme
              1 Reply Last reply Reply Quote 0
              • fredldotmeF Offline
                fredldotme
                last edited by fredldotme

                For those wanting to try clickable with the new docker snap, or wanting to build other images on your devices, I noticed a serious performance hit in creating clickable images with the new Docker 29.0.0 which is due to the containerd-snapshotter feature. You can disable it easily though, restoring snapshot creation to a previous codepath. You'll just have to edit your /var/snap/docker/current/config/daemon.json configuration:

                $ cat /var/snap/docker/current/config/daemon.json
                {
                    "log-level":        "error",
                    "features": {
                        "containerd-snapshotter": false
                    }
                }
                

                Make sure to restart your Docker daemon afterwards: sudo snap restart docker

                For a list of my contributions to Ubuntu Touch visit: https://fredl.me

                If you have enjoyed my work on Ubuntu Touch over the years, please donate to my causes:

                • PayPal: https://paypal.me/beidl
                • Liberapay: https://liberapay.com/fredldotme
                1 Reply Last reply Reply Quote 0
                • fredldotmeF Offline
                  fredldotme
                  last edited by

                  Good news, the xtables-enabled Docker Snap is now available in the edge channel. I've updated the How to section with the new install commands. If you want to refresh: sudo snap refresh docker --edge --devmode

                  For a list of my contributions to Ubuntu Touch visit: https://fredl.me

                  If you have enjoyed my work on Ubuntu Touch over the years, please donate to my causes:

                  • PayPal: https://paypal.me/beidl
                  • Liberapay: https://liberapay.com/fredldotme
                  1 Reply Last reply Reply Quote 2
                  • B Offline
                    bbiw
                    last edited by bbiw

                    On Fairphone 4 i also have to do a: sudo chmod 666 /var/run/docker.sock and according to https://clickable-ut.dev/en/latest/install.html sudo snap connect clickable:ssh-keys and sudo snap connect clickable:etc-gitconfig are needed after installing clickable, too.

                    P.S.: *.click package compilation works 😁

                    1 Reply Last reply Reply Quote 0
                    • fredldotmeF Offline
                      fredldotme
                      last edited by

                      Good news: Now that Ubuntu Touch 24.04-1.2 is out, you are able to install Docker without --devmode!

                      For a list of my contributions to Ubuntu Touch visit: https://fredl.me

                      If you have enjoyed my work on Ubuntu Touch over the years, please donate to my causes:

                      • PayPal: https://paypal.me/beidl
                      • Liberapay: https://liberapay.com/fredldotme
                      1 Reply Last reply Reply Quote 3
                      • System unpinned this topic on

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      • First post
                        Last post