├── .github └── workflows │ └── actions.yml ├── .gitignore ├── LICENSE ├── README.md └── update.sh /.github/workflows/actions.yml: -------------------------------------------------------------------------------- 1 | name: actions 2 | on: 3 | push: 4 | schedule: 5 | - cron: '0 0 * * 0' 6 | jobs: 7 | ubuntu-debootstrap: 8 | runs-on: ubuntu-latest 9 | strategy: 10 | matrix: 11 | QEMU_VER: [v6.1.0-1] 12 | DOCKER_REPO: [docker.io/multiarch/ubuntu-debootstrap] 13 | VERSION: ["14.04", "16.04", "18.04", "20.04", "22.04"] 14 | UNAME_ARCH: [x86_64, arm64, armv7l, i386, powerpc, ppc64el] 15 | include: 16 | - {ARCH: amd64, QEMU_ARCH: x86_64, UNAME_ARCH: x86_64} 17 | - {ARCH: arm64, QEMU_ARCH: aarch64, UNAME_ARCH: arm64} 18 | - {ARCH: armhf, QEMU_ARCH: arm, UNAME_ARCH: armv7l} 19 | - {ARCH: i386, QEMU_ARCH: i386, UNAME_ARCH: i386} 20 | - {ARCH: powerpc, QEMU_ARCH: ppc, UNAME_ARCH: powerpc} 21 | - {ARCH: ppc64el, QEMU_ARCH: ppc64, UNAME_ARCH: ppc64el} 22 | - {VERSION: "14.04", INCLUDE: "wget", SUITE: trusty} 23 | - {VERSION: "16.04", INCLUDE: "iproute2,wget", SUITE: xenial} 24 | - {VERSION: "18.04", INCLUDE: "iproute2,wget", SUITE: bionic} 25 | - {VERSION: "20.04", INCLUDE: "iproute2,wget", SUITE: focal} 26 | - {VERSION: "22.04", INCLUDE: "iproute2,wget", SUITE: jammy} 27 | exclude: 28 | - {VERSION: "18.04", UNAME_ARCH: powerpc} 29 | - {VERSION: "20.04", UNAME_ARCH: powerpc} 30 | - {VERSION: "22.04", UNAME_ARCH: powerpc} 31 | steps: 32 | - uses: actions/checkout@v2 33 | - name: Build 34 | run: | 35 | sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu focal main universe' 36 | sudo apt-get update && sudo apt-get install -y qemu-user-static debootstrap 37 | ./update.sh -a ${{ matrix.ARCH }} -v ${{ matrix.VERSION }} -q ${{ matrix.QEMU_ARCH }} -u ${{ matrix.QEMU_VER }} -d ${{ matrix.DOCKER_REPO }} -s ${{ matrix.SUITE }} -i ${{ matrix.INCLUDE }} -o ${{ matrix.UNAME_ARCH }} 38 | - name: Publish 39 | if: github.ref == 'refs/heads/master' 40 | run: | 41 | docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }} 42 | docker push -a ${{ matrix.DOCKER_REPO }} 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | */full 2 | rootfs.tar.* 3 | Dockerfile 4 | build.log 5 | build-command.txt 6 | rootfs/ 7 | *~ 8 | .#* 9 | *# -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Multiarch 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | Status API Training Shop Blog About 23 | © 2016 GitHub, Inc. Terms Privacy Security Contact Help 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > Notice: these images may not be fully up to date, it is suggested to use the [ubuntu-core](https://github.com/multiarch/ubuntu-core) image instead 2 | 3 | # :earth_africa: ubuntu-debootstrap [![actions](https://github.com/multiarch/ubuntu-debootstrap/actions/workflows/actions.yml/badge.svg)](https://github.com/multiarch/ubuntu-debootstrap/actions/workflows/actions.yml) 4 | 5 | ![](https://raw.githubusercontent.com/multiarch/dockerfile/master/logo.jpg) 6 | 7 | Multiarch Ubuntu images for Docker. 8 | 9 | * `multiarch/ubuntu-debootstrap` on [Docker Hub](https://hub.docker.com/r/multiarch/ubuntu-debootstrap/) 10 | * [Available tags](https://hub.docker.com/r/multiarch/ubuntu-debootstrap/tags/) 11 | 12 | ## Usage 13 | 14 | Once you need to configure binfmt-support on your Docker host. 15 | This works locally or remotely (i.e using boot2docker or swarm). 16 | 17 | ```console 18 | # configure binfmt-support on the Docker host (works locally or remotely, i.e: using boot2docker) 19 | $ docker run --rm --privileged multiarch/qemu-user-static:register --reset 20 | ``` 21 | 22 | Then you can run an `armhf` image from your `x86_64` Docker host. 23 | 24 | ```console 25 | $ docker run -it --rm multiarch/ubuntu-debootstrap:armhf-wily 26 | root@a0818570f614:/# uname -a 27 | Linux a0818570f614 4.1.13-boot2docker #1 SMP Fri Nov 20 19:05:50 UTC 2015 armv7l armv7l armv7l GNU/Linux 28 | root@a0818570f614:/# exit 29 | ``` 30 | 31 | Or an `x86_64` image from your `x86_64` Docker host, directly, without qemu emulation. 32 | 33 | ```console 34 | $ docker run -it --rm multiarch/ubuntu-debootstrap:amd64-wily 35 | root@27fe384370c9:/# uname -a 36 | Linux 27fe384370c9 4.1.13-boot2docker #1 SMP Fri Nov 20 19:05:50 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux 37 | root@27fe384370c9:/# 38 | ``` 39 | 40 | It also works for `arm64` 41 | 42 | ```console 43 | $ docker run -it --rm multiarch/ubuntu-debootstrap:arm64-wily 44 | root@723fb9f184fa:/# uname -a 45 | Linux 723fb9f184fa 4.1.13-boot2docker #1 SMP Fri Nov 20 19:05:50 UTC 2015 aarch64 aarch64 aarch64 GNU/Linux 46 | ``` 47 | 48 | ## License 49 | 50 | MIT 51 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | # A POSIX variable 5 | OPTIND=1 # Reset in case getopts has been used previously in the shell. 6 | 7 | while getopts "a:v:q:u:d:s:i:o:" opt; do 8 | case "$opt" in 9 | a) ARCH=$OPTARG 10 | ;; 11 | v) VERSION=$OPTARG 12 | ;; 13 | q) QEMU_ARCH=$OPTARG 14 | ;; 15 | u) QEMU_VER=$OPTARG 16 | ;; 17 | d) DOCKER_REPO=$OPTARG 18 | ;; 19 | s) SUITE=$OPTARG 20 | ;; 21 | i) INCLUDE=$OPTARG 22 | ;; 23 | o) UNAME_ARCH=$OPTARG 24 | ;; 25 | esac 26 | done 27 | 28 | shift $((OPTIND-1)) 29 | 30 | [ "$1" = "--" ] && shift 31 | 32 | dir="$VERSION" 33 | COMPONENTS="main" 34 | VARIANT="minbase" 35 | args=( -d "$dir" debootstrap --variant="$VARIANT" --components="$COMPONENTS" --include="$INCLUDE" --arch="$ARCH" "$SUITE" ) 36 | 37 | mkdir -p mkimage $dir 38 | curl https://raw.githubusercontent.com/moby/moby/6f78b438b88511732ba4ac7c7c9097d148ae3568/contrib/mkimage.sh > mkimage.sh 39 | curl https://raw.githubusercontent.com/moby/moby/6f78b438b88511732ba4ac7c7c9097d148ae3568/contrib/mkimage/debootstrap > mkimage/debootstrap 40 | chmod +x mkimage.sh mkimage/debootstrap 41 | 42 | mkimage="$(readlink -f "${MKIMAGE:-"mkimage.sh"}")" 43 | { 44 | echo "$(basename "$mkimage") ${args[*]/"$dir"/.}" 45 | echo 46 | echo 'https://github.com/moby/moby/blob/6f78b438b88511732ba4ac7c7c9097d148ae3568/contrib/mkimage.sh' 47 | } > "$dir/build-command.txt" 48 | 49 | sudo DEBOOTSTRAP="qemu-debootstrap" nice ionice -c 3 "$mkimage" "${args[@]}" 2>&1 | tee "$dir/build.log" 50 | cat "$dir/build.log" 51 | sudo chown -R "$(id -u):$(id -g)" "$dir" 52 | 53 | xz -d < $dir/rootfs.tar.xz | gzip -c > $dir/rootfs.tar.gz 54 | sed -i /^ENV/d "${dir}/Dockerfile" 55 | echo "ENV ARCH=${UNAME_ARCH} UBUNTU_SUITE=${SUITE} DOCKER_REPO=${DOCKER_REPO}" >> "${dir}/Dockerfile" 56 | 57 | if [ "$DOCKER_REPO" ]; then 58 | docker build -t "${DOCKER_REPO}:${ARCH}-${SUITE}-slim" "${dir}" 59 | mkdir -p "${dir}/full" 60 | ( 61 | cd "${dir}/full" 62 | if [ ! -f x86_64_qemu-${QEMU_ARCH}-static.tar.gz ]; then 63 | wget -N https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VER}/x86_64_qemu-${QEMU_ARCH}-static.tar.gz 64 | fi 65 | tar xf x86_64_qemu-*.gz 66 | ) 67 | cat > "${dir}/full/Dockerfile" <