Skip to content
Snippets Groups Projects

Docker images for ARM

Closed username-removed-852722 requested to merge (removed):armhf into master

Looking for a runner for ARM devices a while ago just found the binaries but no docker image, so based on the alpine runner for amd64 Dockerfiles decided to build one for ARM, been using it for a couple of weeks, here's the repository.

What does this MR do?

  • Prosposal for ARM docker runner based on the amd64 alpine Dockerfile.

Why was this MR needed?

  • Because there is no official docker image for ARM available.

Are there points in the code the reviewer needs to double check?

Since the image needs dumb-init in order to work, but it is not officially compiled for ARM, this is built in a separate job within the CI file attached to this MR.

  • .gitlab-ci.yml needs to be edited/moved.

Does this MR meet the acceptance criteria?

  • Built, tested and currently being used in some personal projects, the pipelines passed
  • Documentation created/updated: Pending I've found some problems detecting the docker socket, wrote a usage guide , which includes a trobleshooting for the socket detection as well.
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master

What are the relevant issue numbers?

#2076

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • username-removed-852722 changed title from Armhf to Docker images for ARM

    changed title from Armhf to Docker images for ARM

  • username-removed-852722 marked the checklist item Documentation created/updated: Pending I've found some problems detecting the docker socket, wrote a usage guide , which includes a trobleshooting for the socket detection as well. as completed

    marked the checklist item Documentation created/updated: Pending I've found some problems detecting the docker socket, wrote a usage guide , which includes a trobleshooting for the socket detection as well. as completed

  • username-removed-852722 marked the checklist item Documentation created/updated: Pending I've found some problems detecting the docker socket, wrote a usage guide , which includes a trobleshooting for the socket detection as well. as incomplete

    marked the checklist item Documentation created/updated: Pending I've found some problems detecting the docker socket, wrote a usage guide , which includes a trobleshooting for the socket detection as well. as incomplete

  • username-removed-852722 marked the checklist item Added for this feature/bug as incomplete

    marked the checklist item Added for this feature/bug as incomplete

  • username-removed-852722 marked the checklist item Added for this feature/bug as completed

    marked the checklist item Added for this feature/bug as completed

  • Maybe an alternative solution is to use the dumb-init provided in PyPI (as mentioned on the dumb-init web site). You need to make sure that PyPI is installed in your image and then you can install dumb-init.

    For example, here is a change I did on my local clone. I created a new file Dockerfile.armhf under dockerfiles/ubuntu/, and here is the diff betweent he original Dockerfile (for x86_64) and the one I created for ARMHF:

    $ diff -Nau dockerfiles/ubuntu/Dockerfile dockerfiles/ubuntu/Dockerfile.armhf
    --- dockerfiles/ubuntu/Dockerfile       2017-04-15 07:36:11.517899904 +0000
    +++ dockerfiles/ubuntu/Dockerfile.armhf 2017-04-18 09:18:40.207952211 +0000
    @@ -1,7 +1,4 @@
    -FROM ubuntu:14.04
    -
    -ADD https://github.com/Yelp/dumb-init/releases/download/v1.0.2/dumb-init_1.0.2_amd64 /usr/bin/dumb-init
    -RUN chmod +x /usr/bin/dumb-init
    +FROM armhf/ubuntu:14.04
    
     RUN apt-get update -y && \
         apt-get upgrade -y && \
    @@ -9,15 +6,21 @@
         apt-get clean && \
         rm -rf /var/lib/apt/lists/*
    
    -COPY gitlab-ci-multi-runner_amd64.deb /tmp/
    -RUN dpkg -i /tmp/gitlab-ci-multi-runner_amd64.deb; \
    +RUN apt-get update -y && \
    +    apt-get install -y gcc python-pip && \
    +    pip install dumb-init && \
    +    apt-get clean && \
    +    rm -rf /var/lib/apt/lists/*
    +
    +COPY gitlab-ci-multi-runner_armhf.deb /tmp/
    +RUN dpkg -i /tmp/gitlab-ci-multi-runner_armhf.deb; \
         apt-get update &&  \
         apt-get -f install -y && \
         apt-get clean && \
         rm -rf /var/lib/apt/lists/* && \
    -    rm /tmp/gitlab-ci-multi-runner_amd64.deb && \
    +    rm /tmp/gitlab-ci-multi-runner_armhf.deb && \
         gitlab-runner --version && \
    -    wget -q https://github.com/docker/machine/releases/download/v0.10.0/docker-machine-Linux-x86_64 -O /usr/bin/docker-machine && \
    +    wget -q https://github.com/docker/machine/releases/download/v0.10.0/docker-machine-Linux-armhf -O /usr/bin/docker-machine && \
         chmod +x /usr/bin/docker-machine && \
         mkdir -p /etc/gitlab-runner/certs && \
         chmod -R 700 /etc/gitlab-runner
    @@ -26,5 +29,5 @@
     RUN chmod +x /entrypoint
    
     VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner"]
    -ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint"]
    +ENTRYPOINT ["/usr/local/bin/dumb-init", "/entrypoint"]
     CMD ["run", "--user=gitlab-runner", "--working-directory=/home/gitlab-runner"]

    That example is running on 2 Raspberry Pi 2 (one running Raspbian with Docker 17.03.1 and the other one running Ubuntu 16.04 with Docker 17.04.0).

  • @huygens I saw that as an option too, but the main purpose of this Dockerfile is to get an image as lightweight as possible, that's why it builds the dumb-init in another job, adding those packages (which will only be used once) to the main image will just increase its final size.

    Here's another approach to use within the main image.

    wget http://ftp.us.debian.org/debian/pool/main/d/dumb-init/dumb-init_1.2.0-1_armhf.deb
    ar -x *.deb
    tar -xvf data.tar.xz -C /
    ls /usr/bin/dumb-init

    and then remove all the unused files, and it could do the same with the gitlab-ci-multi-runner package.

  • @klud cool! I'm going to see if that reduces my image size.

    Usually (but not always) I try to avoid Alpine Linux, it's a cool distro, don't get me wrong, but I got caught several times because it uses musl libc instead of glibc (so you cannot run easily some binaries that you build on/for other distros).

    Anyway I very much like your MR.

Please register or sign in to reply
Loading