├── .gitignore ├── LICENSE ├── README.md ├── logo.jpg ├── method-a ├── .gitignore ├── Dockerfile.multiarch ├── Makefile ├── README.md ├── overlay-amd64 │ └── amd64 ├── overlay-armhf │ └── armhf ├── overlay-common │ └── common └── overlay-powerpc │ └── powerpc ├── method-b ├── .gitignore ├── Dockerfile.amd64 ├── Dockerfile.armhf ├── Dockerfile.powerpc ├── Makefile ├── README.md ├── overlay-amd64 │ └── amd64 ├── overlay-armhf │ └── armhf ├── overlay-common │ └── common └── overlay-powerpc │ └── powerpc ├── method-c ├── .gitignore ├── Dockerfile ├── Makefile ├── README.md ├── overlay-amd64 │ └── amd64 ├── overlay-armhf │ └── armhf ├── overlay-common │ └── common └── overlay-powerpc │ └── powerpc ├── method-d ├── .gitignore ├── Dockerfile ├── Makefile ├── README.md ├── overlay-amd64 │ └── amd64 ├── overlay-armhf │ └── armhf ├── overlay-common │ └── common └── overlay-powerpc │ └── powerpc ├── method-e ├── .gitignore ├── Dockerfile ├── Makefile ├── README.md ├── overlay-amd64 │ └── amd64 ├── overlay-armhf │ └── armhf ├── overlay-common │ └── common └── overlay-powerpc │ └── powerpc ├── method-f ├── Dockerfile ├── Makefile ├── README.md ├── overlay-amd64 │ └── amd64 ├── overlay-armhf │ └── armhf ├── overlay-common │ └── common └── overlay-powerpc │ └── powerpc ├── method-g ├── .gitignore ├── Dockerfile ├── Makefile ├── README.md ├── overlay-amd64 │ └── amd64 ├── overlay-armhf │ └── armhf ├── overlay-common │ └── common └── overlay-powerpc │ └── powerpc └── method-h ├── Dockerfile ├── Makefile ├── README.md ├── overlay-amd64 └── amd64 ├── overlay-armhf └── armhf ├── overlay-common └── common └── overlay-powerpc └── powerpc /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *# 3 | .#* 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dockerfile 2 | Multiarch Dockerfile POC 3 | 4 | ![](https://raw.githubusercontent.com/multiarch/dockerfile/master/logo.jpg) 5 | 6 | --- 7 | 8 | **Update**: method G is now successfully implemented here: https://github.com/scaleway/image-ubuntu/tree/master/15.10, we now hope the method H to be possible soon, so we can switch again 9 | 10 | --- 11 | 12 | | A | B | C | D | E | F | G | H 13 | -----------------------------------------------|---|---|---|---|---|---|---|--- 14 | Unique Dockerfile | x | | x | | x | x | x | x 15 | Complete multiarch support | x | x | | | x | | x | x 16 | Does not require a Makefile for amd64 | | | x | | x | x | x | x 17 | Gentle multiline support | | | | | | x | x | x 18 | Dockerfile is easily readable | | x | x | | x | x | x | x 19 | Disk-friendly (do not create tmp context dir) | x | x | | | | x | | x 20 | Does not need to patch Docker | x | x | x | x | x | | x | 21 | | | | | | | | | 22 | *Votes* | | | | |0.5| |1.5| 3 23 | 24 | --- 25 | 26 | Vote scoring (per person): 27 | * First choice: 1 vote 28 | * Secondary choice(s): 0.5 vote 29 | -------------------------------------------------------------------------------- /logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multiarch/dockerfile/f8b72932bb60df615b249f86792bdb77488a9dec/logo.jpg -------------------------------------------------------------------------------- /method-a/.gitignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | -------------------------------------------------------------------------------- /method-a/Dockerfile.multiarch: -------------------------------------------------------------------------------- 1 | FROM multiarch/ubuntu-debootstrap:amd64-wily # arch=amd64 2 | FROM multiarch/ubuntu-debootstrap:armhf-wily # arch=armhf 3 | FROM multiarch/ubuntu-debootstrap:powerpc-wily # arch=powerpc 4 | 5 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 6 | 7 | RUN echo "I'm amd64" # arch=amd64 8 | RUN echo "I'm arhmf" # arch=armhf 9 | RUN echo "I'm powerpc" # arch=powerpc 10 | 11 | ADD overlay-common /overlay 12 | ADD overlay-amd64 /overlay # arch=amd64 13 | ADD overlay-armhf /overlay # arch=armhf 14 | ADD overlay-powerpc /overlay # arch=powerpc 15 | 16 | CMD ["uname -a; cowsay hello world"] 17 | -------------------------------------------------------------------------------- /method-a/Makefile: -------------------------------------------------------------------------------- 1 | TARGET ?= amd64 2 | ARCHS ?= amd64 armhf powerpc 3 | 4 | 5 | build: Dockerfile 6 | docker build --no-cache -t multiarch-dockerfile:$(TARGET)-methoda . 7 | docker run --rm multiarch-dockerfile:$(TARGET)-methoda uname -a 8 | docker run --rm multiarch-dockerfile:$(TARGET)-methoda ls -la /usr/bin/wget 9 | docker run --rm multiarch-dockerfile:$(TARGET)-methoda ls -la /overlay 10 | 11 | 12 | .PHONY: Dockerfile 13 | Dockerfile: Dockerfile.multiarch 14 | cp $< $@ 15 | for arch in $(ARCHS); do \ 16 | if [ "$$arch" != "$(TARGET)" ]; then \ 17 | sed -i "/arch=$$arch/d" $@; \ 18 | fi; \ 19 | done 20 | sed -i 's/#[[:space:]]*arch=$(TARGET)//g' $@ 21 | cat $@ 22 | -------------------------------------------------------------------------------- /method-a/README.md: -------------------------------------------------------------------------------- 1 | ```console 2 | root@fwrz:~/dockerfile/method-a# make TARGET=powerpc 3 | $ cp Dockerfile.multiarch Dockerfile 4 | $ for arch in amd64 armhf powerpc; do \ 5 | if [ "$arch" != "powerpc" ]; then \ 6 | sed -i "/arch=$arch/d" Dockerfile; \ 7 | fi; \ 8 | done 9 | $ sed -i 's/#[[:space:]]*arch=powerpc//g' Dockerfile 10 | $ cat Dockerfile 11 | FROM multiarch/ubuntu-debootstrap:powerpc-wily 12 | 13 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 14 | 15 | RUN echo "I'm powerpc" 16 | 17 | ADD overlay-common /overlay 18 | ADD overlay-powerpc /overlay 19 | 20 | CMD ["uname -a; cowsay hello world"] 21 | $ docker build --no-cache -t multiarch-dockerfile:powerpc-methoda . 22 | Sending build context to Docker daemon 22.53 kB 23 | Step 1 : FROM multiarch/ubuntu-debootstrap:powerpc-wily 24 | ---> 6c3238952754 25 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 26 | ---> Running in f78871314022 27 | Reading package lists... 28 | Reading package lists... 29 | Building dependency tree... 30 | wget is already the newest version. 31 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 32 | ---> 59404413b764 33 | Removing intermediate container f78871314022 34 | Step 3 : RUN echo "I'm powerpc" 35 | ---> Running in a26ba1ff3d6e 36 | I'm powerpc 37 | ---> 86b8b14153b0 38 | Removing intermediate container a26ba1ff3d6e 39 | Step 4 : ADD overlay-common /overlay 40 | ---> 49a81d9dbdfc 41 | Removing intermediate container 49c8b95641cf 42 | Step 5 : ADD overlay-powerpc /overlay 43 | ---> 7d9cf3c46424 44 | Removing intermediate container 1e6689f2ed0c 45 | Step 6 : CMD uname -a; cowsay hello world 46 | ---> Running in 8ab55a15a06e 47 | ---> 2e422ef7c180 48 | Removing intermediate container 8ab55a15a06e 49 | Successfully built 2e422ef7c180 50 | $ docker run --rm multiarch-dockerfile:powerpc-methoda uname -a 51 | Linux cf6c72b30773 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 ppc ppc ppc GNU/Linux 52 | $ docker run --rm multiarch-dockerfile:powerpc-methoda ls -la /usr/bin/wget 53 | -rwxr-xr-x 1 root root 481776 Jan 13 2015 /usr/bin/wget 54 | $ docker run --rm multiarch-dockerfile:powerpc-methoda ls -la /overlay 55 | total 16 56 | drwxr-xr-x 2 root root 4096 Dec 7 17:26 . 57 | drwxr-xr-x 34 root root 4096 Dec 7 17:26 .. 58 | -rw-r--r-- 1 root root 7 Dec 7 17:26 common 59 | -rw-r--r-- 1 root root 8 Dec 7 17:26 powerpc 60 | ``` 61 | 62 | ```console 63 | root@fwrz:~/dockerfile/method-a# make TARGET=armhf 64 | $ cp Dockerfile.multiarch Dockerfile 65 | $ for arch in amd64 armhf powerpc; do \ 66 | if [ "$arch" != "armhf" ]; then \ 67 | sed -i "/arch=$arch/d" Dockerfile; \ 68 | fi; \ 69 | done 70 | $ sed -i 's/#[[:space:]]*arch=armhf//g' Dockerfile 71 | $ cat Dockerfile 72 | FROM multiarch/ubuntu-debootstrap:armhf-wily 73 | 74 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 75 | 76 | RUN echo "I'm arhmf" 77 | 78 | ADD overlay-common /overlay 79 | ADD overlay-armhf /overlay 80 | 81 | CMD ["uname -a; cowsay hello world"] 82 | $ docker build --no-cache -t multiarch-dockerfile:armhf-methoda . 83 | Sending build context to Docker daemon 22.53 kB 84 | Step 1 : FROM multiarch/ubuntu-debootstrap:armhf-wily 85 | ---> aeed111b7935 86 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 87 | ---> Running in ba2ad932f621 88 | Reading package lists... 89 | Reading package lists... 90 | Building dependency tree... 91 | wget is already the newest version. 92 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 93 | ---> b6102124c6b2 94 | Removing intermediate container ba2ad932f621 95 | Step 3 : RUN echo "I'm arhmf" 96 | ---> Running in e6c8fbd8ddef 97 | I'm arhmf 98 | ---> a4741a22b7d8 99 | Removing intermediate container e6c8fbd8ddef 100 | Step 4 : ADD overlay-common /overlay 101 | ---> aef304397140 102 | Removing intermediate container 9c89de07b8f4 103 | Step 5 : ADD overlay-armhf /overlay 104 | ---> 64e2e3512d32 105 | Removing intermediate container 70891364d5d2 106 | Step 6 : CMD uname -a; cowsay hello world 107 | ---> Running in cdfd324a0ec4 108 | ---> 3b05c7c87bf1 109 | Removing intermediate container cdfd324a0ec4 110 | Successfully built 3b05c7c87bf1 111 | $ docker run --rm multiarch-dockerfile:armhf-methoda uname -a 112 | Linux 859075ed5622 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 armv7l armv7l armv7l GNU/Linux 113 | $ docker run --rm multiarch-dockerfile:armhf-methoda ls -la /usr/bin/wget 114 | -rwxr-xr-x 1 root root 330100 Jan 13 2015 /usr/bin/wget 115 | $ docker run --rm multiarch-dockerfile:armhf-methoda ls -la /overlay 116 | total 16 117 | drwxr-xr-x 2 root root 4096 Dec 7 17:27 . 118 | drwxr-xr-x 34 root root 4096 Dec 7 17:27 .. 119 | -rw-r--r-- 1 root root 6 Dec 7 17:26 armhf 120 | -rw-r--r-- 1 root root 7 Dec 7 17:26 common 121 | ``` 122 | 123 | ```console 124 | root@fwrz:~/dockerfile/method-a# make TARGET=amd64 125 | $ cp Dockerfile.multiarch Dockerfile 126 | $ for arch in amd64 armhf powerpc; do \ 127 | if [ "$arch" != "amd64" ]; then \ 128 | sed -i "/arch=$arch/d" Dockerfile; \ 129 | fi; \ 130 | done 131 | $ sed -i 's/#[[:space:]]*arch=amd64//g' Dockerfile 132 | $ cat Dockerfile 133 | FROM multiarch/ubuntu-debootstrap:amd64-wily 134 | 135 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 136 | 137 | RUN echo "I'm amd64" 138 | 139 | ADD overlay-common /overlay 140 | ADD overlay-amd64 /overlay 141 | 142 | CMD ["uname -a; cowsay hello world"] 143 | $ docker build --no-cache -t multiarch-dockerfile:amd64-methoda . 144 | Sending build context to Docker daemon 22.53 kB 145 | Step 1 : FROM multiarch/ubuntu-debootstrap:amd64-wily 146 | ---> 0fdd22782955 147 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 148 | ---> Running in ab74e23531fc 149 | Get:1 http://archive.ubuntu.com wily InRelease [218 kB] 150 | Get:2 http://archive.ubuntu.com wily-updates InRelease [64.4 kB] 151 | Get:3 http://archive.ubuntu.com wily-security InRelease [64.4 kB] 152 | Get:4 http://archive.ubuntu.com wily/main amd64 Packages [1833 kB] 153 | Get:5 http://archive.ubuntu.com wily-updates/main amd64 Packages [117 kB] 154 | Get:6 http://archive.ubuntu.com wily-security/main amd64 Packages [74.3 kB] 155 | Fetched 2370 kB in 1s (1472 kB/s) 156 | Reading package lists... 157 | Reading package lists... 158 | Building dependency tree... 159 | Reading state information... 160 | wget is already the newest version. 161 | 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 162 | ---> 7f80761c3adb 163 | Removing intermediate container ab74e23531fc 164 | Step 3 : RUN echo "I'm amd64" 165 | ---> Running in e48d619fb49a 166 | I'm amd64 167 | ---> b8d29f9a3488 168 | Removing intermediate container e48d619fb49a 169 | Step 4 : ADD overlay-common /overlay 170 | ---> af283c9ef176 171 | Removing intermediate container c61ade2723fd 172 | Step 5 : ADD overlay-amd64 /overlay 173 | ---> 5dc0912a2ff8 174 | Removing intermediate container 55a112533eaa 175 | Step 6 : CMD uname -a; cowsay hello world 176 | ---> Running in 62f07922c8bb 177 | ---> 1ac9e323a08b 178 | Removing intermediate container 62f07922c8bb 179 | Successfully built 1ac9e323a08b 180 | $ docker run --rm multiarch-dockerfile:amd64-methoda uname -a 181 | Linux 5a7b53e84071 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux 182 | $ docker run --rm multiarch-dockerfile:amd64-methoda ls -la /usr/bin/wget 183 | -rwxr-xr-x 1 root root 454176 Jan 13 2015 /usr/bin/wget 184 | $ docker run --rm multiarch-dockerfile:amd64-methoda ls -la /overlay 185 | total 16 186 | drwxr-xr-x 2 root root 4096 Dec 7 17:27 . 187 | drwxr-xr-x 36 root root 4096 Dec 7 17:27 .. 188 | -rw-r--r-- 1 root root 6 Dec 7 17:26 amd64 189 | -rw-r--r-- 1 root root 7 Dec 7 17:26 common 190 | ``` 191 | -------------------------------------------------------------------------------- /method-a/overlay-amd64/amd64: -------------------------------------------------------------------------------- 1 | amd64 2 | -------------------------------------------------------------------------------- /method-a/overlay-armhf/armhf: -------------------------------------------------------------------------------- 1 | armhf 2 | -------------------------------------------------------------------------------- /method-a/overlay-common/common: -------------------------------------------------------------------------------- 1 | common 2 | -------------------------------------------------------------------------------- /method-a/overlay-powerpc/powerpc: -------------------------------------------------------------------------------- 1 | powerpc 2 | -------------------------------------------------------------------------------- /method-b/.gitignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | -------------------------------------------------------------------------------- /method-b/Dockerfile.amd64: -------------------------------------------------------------------------------- 1 | FROM multiarch/ubuntu-debootstrap:amd64-wily 2 | 3 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 4 | 5 | RUN echo "I'm amd64" 6 | 7 | ADD overlay-common /overlay 8 | ADD overlay-amd64 /overlay 9 | 10 | CMD ["uname -a; cowsay hello world"] 11 | -------------------------------------------------------------------------------- /method-b/Dockerfile.armhf: -------------------------------------------------------------------------------- 1 | FROM multiarch/ubuntu-debootstrap:armhf-wily 2 | 3 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 4 | 5 | RUN echo "I'm armhf" 6 | 7 | ADD overlay-common /overlay 8 | ADD overlay-armhf /overlay 9 | 10 | CMD ["uname -a; cowsay hello world"] 11 | -------------------------------------------------------------------------------- /method-b/Dockerfile.powerpc: -------------------------------------------------------------------------------- 1 | FROM multiarch/ubuntu-debootstrap:powerpc-wily 2 | 3 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 4 | 5 | RUN echo "I'm powerpc" 6 | 7 | ADD overlay-common /overlay 8 | ADD overlay-powerpc /overlay 9 | 10 | CMD ["uname -a; cowsay hello world"] 11 | -------------------------------------------------------------------------------- /method-b/Makefile: -------------------------------------------------------------------------------- 1 | TARGET ?= amd64 2 | 3 | 4 | build: Dockerfile 5 | docker build --no-cache -t multiarch-dockerfile:$(TARGET)-methodb . 6 | docker run --rm multiarch-dockerfile:$(TARGET)-methodb uname -a 7 | docker run --rm multiarch-dockerfile:$(TARGET)-methodb ls -la /usr/bin/wget 8 | docker run --rm multiarch-dockerfile:$(TARGET)-methodb ls -la /overlay 9 | 10 | 11 | .PHONY: Dockerfile 12 | Dockerfile: Dockerfile.$(TARGET) 13 | cp $< $@ 14 | -------------------------------------------------------------------------------- /method-b/README.md: -------------------------------------------------------------------------------- 1 | ```console 2 | root@fwrz:~/dockerfile/method-b# make TARGET=amd64 3 | cp Dockerfile.amd64 Dockerfile 4 | docker build --no-cache -t multiarch-dockerfile:amd64-methodb . 5 | Sending build context to Docker daemon 13.31 kB 6 | Step 1 : FROM multiarch/ubuntu-debootstrap:amd64-wily 7 | ---> 0fdd22782955 8 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 9 | ---> Running in 3a584ab356c6 10 | Get:1 http://archive.ubuntu.com wily InRelease [218 kB] 11 | Get:2 http://archive.ubuntu.com wily-updates InRelease [64.4 kB] 12 | Get:3 http://archive.ubuntu.com wily-security InRelease [64.4 kB] 13 | Get:4 http://archive.ubuntu.com wily/main amd64 Packages [1833 kB] 14 | Get:5 http://archive.ubuntu.com wily-updates/main amd64 Packages [117 kB] 15 | Get:6 http://archive.ubuntu.com wily-security/main amd64 Packages [74.3 kB] 16 | Fetched 2370 kB in 3s (780 kB/s) 17 | Reading package lists... 18 | Reading package lists... 19 | Building dependency tree... 20 | Reading state information... 21 | wget is already the newest version. 22 | 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 23 | ---> ed9bf4e6420d 24 | Removing intermediate container 3a584ab356c6 25 | Step 3 : RUN echo "I'm amd64" 26 | ---> Running in 8fee7ba18241 27 | I'm amd64 28 | ---> de30f64fd673 29 | Removing intermediate container 8fee7ba18241 30 | Step 4 : ADD overlay-common /overlay 31 | ---> 0148ecbf5660 32 | Removing intermediate container 6f5b5b74a027 33 | Step 5 : ADD overlay-amd64 /overlay 34 | ---> b6f786d1786a 35 | Removing intermediate container 72eafc0b9bd0 36 | Step 6 : CMD uname -a; cowsay hello world 37 | ---> Running in b052c1a023eb 38 | ---> 6744831add51 39 | Removing intermediate container b052c1a023eb 40 | Successfully built 6744831add51 41 | docker run --rm multiarch-dockerfile:amd64-methodb uname -a 42 | Linux 67da5b14844e 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux 43 | docker run --rm multiarch-dockerfile:amd64-methodb ls -la /usr/bin/wget 44 | -rwxr-xr-x 1 root root 454176 Jan 13 2015 /usr/bin/wget 45 | docker run --rm multiarch-dockerfile:amd64-methodb ls -la /overlay 46 | total 16 47 | drwxr-xr-x 2 root root 4096 Dec 7 17:33 . 48 | drwxr-xr-x 36 root root 4096 Dec 7 17:33 .. 49 | -rw-r--r-- 1 root root 6 Dec 7 17:32 amd64 50 | -rw-r--r-- 1 root root 7 Dec 7 17:32 common 51 | ``` 52 | 53 | ```console 54 | root@fwrz:~/dockerfile/method-b# make TARGET=armhf 55 | cp Dockerfile.armhf Dockerfile 56 | docker build --no-cache -t multiarch-dockerfile:armhf-methodb . 57 | Sending build context to Docker daemon 13.31 kB 58 | Step 1 : FROM multiarch/ubuntu-debootstrap:armhf-wily 59 | ---> aeed111b7935 60 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 61 | ---> Running in 4bd9226e5a8a 62 | Reading package lists... 63 | Reading package lists... 64 | Building dependency tree... 65 | wget is already the newest version. 66 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 67 | ---> 135f6dc0ebb4 68 | Removing intermediate container 4bd9226e5a8a 69 | Step 3 : RUN echo "I'm armhf" 70 | ---> Running in 7f10c60d3290 71 | I'm armhf 72 | ---> 77946dc3f2f6 73 | Removing intermediate container 7f10c60d3290 74 | Step 4 : ADD overlay-common /overlay 75 | ---> 3c5cdb4a812d 76 | Removing intermediate container e9b55bd28fec 77 | Step 5 : ADD overlay-armhf /overlay 78 | ---> f7b64ee3c79d 79 | Removing intermediate container 5d839a039d42 80 | Step 6 : CMD uname -a; cowsay hello world 81 | ---> Running in 94d40dcfaab3 82 | ---> 5718d769e499 83 | Removing intermediate container 94d40dcfaab3 84 | Successfully built 5718d769e499 85 | docker run --rm multiarch-dockerfile:armhf-methodb uname -a 86 | Linux 915b82824bbe 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 armv7l armv7l armv7l GNU/Linux 87 | docker run --rm multiarch-dockerfile:armhf-methodb ls -la /usr/bin/wget 88 | -rwxr-xr-x 1 root root 330100 Jan 13 2015 /usr/bin/wget 89 | docker run --rm multiarch-dockerfile:armhf-methodb ls -la /overlay 90 | total 16 91 | drwxr-xr-x 2 root root 4096 Dec 7 17:40 . 92 | drwxr-xr-x 34 root root 4096 Dec 7 17:40 .. 93 | -rw-r--r-- 1 root root 6 Dec 7 17:32 armhf 94 | -rw-r--r-- 1 root root 7 Dec 7 17:32 common 95 | ``` 96 | 97 | ```console 98 | root@fwrz:~/dockerfile/method-b# make TARGET=powerpc 99 | cp Dockerfile.powerpc Dockerfile 100 | docker build --no-cache -t multiarch-dockerfile:powerpc-methodb . 101 | Sending build context to Docker daemon 13.31 kB 102 | Step 1 : FROM multiarch/ubuntu-debootstrap:powerpc-wily 103 | ---> 6c3238952754 104 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 105 | ---> Running in bd3eda13f04f 106 | Reading package lists... 107 | Reading package lists... 108 | Building dependency tree... 109 | wget is already the newest version. 110 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 111 | ---> 132e6b06db8b 112 | Removing intermediate container bd3eda13f04f 113 | Step 3 : RUN echo "I'm powerpc" 114 | ---> Running in 6a46326d14ed 115 | I'm powerpc 116 | ---> 827b8e6c3b6b 117 | Removing intermediate container 6a46326d14ed 118 | Step 4 : ADD overlay-common /overlay 119 | ---> 830fab32f246 120 | Removing intermediate container 1b90a11e41e0 121 | Step 5 : ADD overlay-powerpc /overlay 122 | ---> 4284b69e34cc 123 | Removing intermediate container 73f13f124f71 124 | Step 6 : CMD uname -a; cowsay hello world 125 | ---> Running in a8c448044a67 126 | ---> 1d0dab2a9a57 127 | Removing intermediate container a8c448044a67 128 | Successfully built 1d0dab2a9a57 129 | docker run --rm multiarch-dockerfile:powerpc-methodb uname -a 130 | Linux af4fff98440d 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 ppc ppc ppc GNU/Linux 131 | docker run --rm multiarch-dockerfile:powerpc-methodb ls -la /usr/bin/wget 132 | -rwxr-xr-x 1 root root 481776 Jan 13 2015 /usr/bin/wget 133 | docker run --rm multiarch-dockerfile:powerpc-methodb ls -la /overlay 134 | total 16 135 | drwxr-xr-x 2 root root 4096 Dec 7 17:41 . 136 | drwxr-xr-x 34 root root 4096 Dec 7 17:41 .. 137 | -rw-r--r-- 1 root root 7 Dec 7 17:32 common 138 | -rw-r--r-- 1 root root 8 Dec 7 17:32 powerpc 139 | ``` 140 | -------------------------------------------------------------------------------- /method-b/overlay-amd64/amd64: -------------------------------------------------------------------------------- 1 | amd64 2 | -------------------------------------------------------------------------------- /method-b/overlay-armhf/armhf: -------------------------------------------------------------------------------- 1 | armhf 2 | -------------------------------------------------------------------------------- /method-b/overlay-common/common: -------------------------------------------------------------------------------- 1 | common 2 | -------------------------------------------------------------------------------- /method-b/overlay-powerpc/powerpc: -------------------------------------------------------------------------------- 1 | powerpc 2 | -------------------------------------------------------------------------------- /method-c/.gitignore: -------------------------------------------------------------------------------- 1 | tmp-*/ -------------------------------------------------------------------------------- /method-c/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM multiarch/ubuntu-debootstrap:amd64-wily 2 | 3 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 4 | 5 | RUN echo "I'm amd64" 6 | 7 | ADD overlay-common /overlay 8 | ADD overlay-amd64 /overlay 9 | 10 | CMD ["uname -a; cowsay hello world"] 11 | -------------------------------------------------------------------------------- /method-c/Makefile: -------------------------------------------------------------------------------- 1 | TARGET ?= amd64 2 | BASE_ARCH = amd64 3 | 4 | 5 | build: tmp-$(TARGET)/Dockerfile 6 | docker build --no-cache -t multiarch-dockerfile:$(TARGET)-methodc tmp-$(TARGET) 7 | docker run --rm multiarch-dockerfile:$(TARGET)-methodc uname -a 8 | docker run --rm multiarch-dockerfile:$(TARGET)-methodc ls -la /usr/bin/wget 9 | docker run --rm multiarch-dockerfile:$(TARGET)-methodc ls -la /overlay 10 | 11 | 12 | tmp-$(TARGET)/Dockerfile: Dockerfile $(shell find overlay-common overlay-$(TARGET)) 13 | rm -rf tmp-$(TARGET) 14 | mkdir tmp-$(TARGET) 15 | cp Dockerfile $@ 16 | cp -rf overlay-common tmp-$(TARGET)/ 17 | cp -rf overlay-$(TARGET) tmp-$(TARGET)/ 18 | if [ "$(TARGET)" != "$(BASE_ARCH)" ]; then \ 19 | sed -i "s/$(BASE_ARCH)/$(TARGET)/g" $@; \ 20 | fi 21 | -------------------------------------------------------------------------------- /method-c/README.md: -------------------------------------------------------------------------------- 1 | ```console 2 | root@fwrz:~/dockerfile/method-c# make TARGET=powerpc 3 | docker build --no-cache -t multiarch-dockerfile:powerpc-methodc tmp-powerpc 4 | Sending build context to Docker daemon 5.12 kB 5 | Step 1 : FROM multiarch/ubuntu-debootstrap:powerpc-wily 6 | ---> 6c3238952754 7 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 8 | ---> Running in 7e61397a6a8f 9 | Reading package lists... 10 | Reading package lists... 11 | Building dependency tree... 12 | wget is already the newest version. 13 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 14 | ---> 91e3ef12ee5f 15 | Removing intermediate container 7e61397a6a8f 16 | Step 3 : RUN echo "I'm powerpc" 17 | ---> Running in 95695d836be3 18 | I'm powerpc 19 | ---> 03ea5d22dd86 20 | Removing intermediate container 95695d836be3 21 | Step 4 : ADD overlay-common /overlay 22 | ---> dc370bd770a0 23 | Removing intermediate container ae58abf7930a 24 | Step 5 : ADD overlay-powerpc /overlay 25 | ---> 76aa634582b2 26 | Removing intermediate container 5d61ff801ae5 27 | Step 6 : CMD uname -a; cowsay hello world 28 | ---> Running in d0c6115fb030 29 | ---> 60929b1c1af3 30 | Removing intermediate container d0c6115fb030 31 | Successfully built 60929b1c1af3 32 | docker run --rm multiarch-dockerfile:powerpc-methodc uname -a 33 | Linux d65c3c2fd881 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 ppc ppc ppc GNU/Linux 34 | docker run --rm multiarch-dockerfile:powerpc-methodc ls -la /usr/bin/wget 35 | -rwxr-xr-x 1 root root 481776 Jan 13 2015 /usr/bin/wget 36 | docker run --rm multiarch-dockerfile:powerpc-methodc ls -la /overlay 37 | total 16 38 | drwxr-xr-x 2 root root 4096 Dec 7 17:50 . 39 | drwxr-xr-x 34 root root 4096 Dec 7 17:50 .. 40 | -rw-r--r-- 1 root root 7 Dec 7 17:50 common 41 | -rw-r--r-- 1 root root 8 Dec 7 17:50 powerpc 42 | ``` 43 | 44 | ```console 45 | root@fwrz:~/dockerfile/method-c# make TARGET=armhf 46 | rm -rf tmp-armhf 47 | mkdir tmp-armhf 48 | cp Dockerfile tmp-armhf/Dockerfile 49 | cp -rf overlay-common tmp-armhf/ 50 | cp -rf overlay-armhf tmp-armhf/ 51 | if [ "armhf" != "amd64" ]; then \ 52 | sed -i "s/amd64/armhf/g" tmp-armhf/Dockerfile; \ 53 | fi 54 | docker build --no-cache -t multiarch-dockerfile:armhf-methodc tmp-armhf 55 | Sending build context to Docker daemon 5.12 kB 56 | Step 1 : FROM multiarch/ubuntu-debootstrap:armhf-wily 57 | ---> aeed111b7935 58 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 59 | ---> Running in 56fa7846b29c 60 | Reading package lists... 61 | Reading package lists... 62 | Building dependency tree... 63 | wget is already the newest version. 64 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 65 | ---> 85f17ffb2d98 66 | Removing intermediate container 56fa7846b29c 67 | Step 3 : RUN echo "I'm armhf" 68 | ---> Running in 3c6299162a20 69 | I'm armhf 70 | ---> 57282dedf806 71 | Removing intermediate container 3c6299162a20 72 | Step 4 : ADD overlay-common /overlay 73 | ---> d4ba6c3bb7e3 74 | Removing intermediate container 9af89635b120 75 | Step 5 : ADD overlay-armhf /overlay 76 | ---> a2f6ae06dd2d 77 | Removing intermediate container e1b7ae2f7cf2 78 | Step 6 : CMD uname -a; cowsay hello world 79 | ---> Running in 295fc71da0a9 80 | ---> 030769d36c96 81 | Removing intermediate container 295fc71da0a9 82 | Successfully built 030769d36c96 83 | docker run --rm multiarch-dockerfile:armhf-methodc uname -a 84 | Linux 90b3d10ba26a 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 armv7l armv7l armv7l GNU/Linux 85 | docker run --rm multiarch-dockerfile:armhf-methodc ls -la /usr/bin/wget 86 | -rwxr-xr-x 1 root root 330100 Jan 13 2015 /usr/bin/wget 87 | docker run --rm multiarch-dockerfile:armhf-methodc ls -la /overlay 88 | total 16 89 | drwxr-xr-x 2 root root 4096 Dec 7 17:51 . 90 | drwxr-xr-x 34 root root 4096 Dec 7 17:51 .. 91 | -rw-r--r-- 1 root root 6 Dec 7 17:50 armhf 92 | -rw-r--r-- 1 root root 7 Dec 7 17:50 common 93 | ``` 94 | 95 | ```console 96 | root@fwrz:~/dockerfile/method-c# make TARGET=amd64 97 | docker build --no-cache -t multiarch-dockerfile:amd64-methodc tmp-amd64 98 | Sending build context to Docker daemon 5.12 kB 99 | Step 1 : FROM multiarch/ubuntu-debootstrap:amd64-wily 100 | ---> 0fdd22782955 101 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 102 | ---> Running in 74182719491f 103 | Get:1 http://archive.ubuntu.com wily InRelease [218 kB] 104 | Get:2 http://archive.ubuntu.com wily-updates InRelease [64.4 kB] 105 | Get:3 http://archive.ubuntu.com wily-security InRelease [64.4 kB] 106 | Get:4 http://archive.ubuntu.com wily/main amd64 Packages [1833 kB] 107 | Get:5 http://archive.ubuntu.com wily-updates/main amd64 Packages [117 kB] 108 | Get:6 http://archive.ubuntu.com wily-security/main amd64 Packages [74.3 kB] 109 | Fetched 2370 kB in 2s (802 kB/s) 110 | Reading package lists... 111 | Reading package lists... 112 | Building dependency tree... 113 | Reading state information... 114 | wget is already the newest version. 115 | 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 116 | ---> 0bec7cdca897 117 | Removing intermediate container 74182719491f 118 | Step 3 : RUN echo "I'm amd64" 119 | ---> Running in 383faaa4311b 120 | I'm amd64 121 | ---> c78b30158d0e 122 | Removing intermediate container 383faaa4311b 123 | Step 4 : ADD overlay-common /overlay 124 | ---> 9cd13c999158 125 | Removing intermediate container 0be40172b307 126 | Step 5 : ADD overlay-amd64 /overlay 127 | ---> e7a3e637701f 128 | Removing intermediate container 700dbe00cc82 129 | Step 6 : CMD uname -a; cowsay hello world 130 | ---> Running in a1e8c0065b92 131 | ---> 44c88be9275d 132 | Removing intermediate container a1e8c0065b92 133 | Successfully built 44c88be9275d 134 | docker run --rm multiarch-dockerfile:amd64-methodc uname -a 135 | Linux 2a22f4e1c91a 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux 136 | docker run --rm multiarch-dockerfile:amd64-methodc ls -la /usr/bin/wget 137 | -rwxr-xr-x 1 root root 454176 Jan 13 2015 /usr/bin/wget 138 | docker run --rm multiarch-dockerfile:amd64-methodc ls -la /overlay 139 | total 16 140 | drwxr-xr-x 2 root root 4096 Dec 7 17:51 . 141 | drwxr-xr-x 36 root root 4096 Dec 7 17:51 .. 142 | -rw-r--r-- 1 root root 6 Dec 7 17:51 amd64 143 | -rw-r--r-- 1 root root 7 Dec 7 17:51 common 144 | ``` 145 | -------------------------------------------------------------------------------- /method-c/overlay-amd64/amd64: -------------------------------------------------------------------------------- 1 | amd64 2 | -------------------------------------------------------------------------------- /method-c/overlay-armhf/armhf: -------------------------------------------------------------------------------- 1 | armhf 2 | -------------------------------------------------------------------------------- /method-c/overlay-common/common: -------------------------------------------------------------------------------- 1 | common 2 | -------------------------------------------------------------------------------- /method-c/overlay-powerpc/powerpc: -------------------------------------------------------------------------------- 1 | powerpc 2 | -------------------------------------------------------------------------------- /method-d/.gitignore: -------------------------------------------------------------------------------- 1 | tmp-*/ -------------------------------------------------------------------------------- /method-d/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM multiarch/ubuntu-debootstrap:amd64-wily # arch=amd64 2 | #FROM multiarch/ubuntu-debootstrap:armhf-wily # arch=armhf 3 | #FROM multiarch/ubuntu-debootstrap:powerpc-wily # arch=powerpc 4 | 5 | ARG ARCH 6 | 7 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 8 | 9 | RUN [ "${ARCH}" = "amd64" ] || echo "Special build instruction for amd64" 10 | 11 | 12 | ADD overlay-common /overlay 13 | ADD overlay-amd64 /overlay # arch=amd64 14 | #ADD overlay-armhf /overlay # arch=armhf 15 | #ADD overlay-powerpc /overlay # arch=powerpc 16 | 17 | CMD ["uname -a; cowsay hello world"] 18 | -------------------------------------------------------------------------------- /method-d/Makefile: -------------------------------------------------------------------------------- 1 | TARGET ?= amd64 2 | ARCHS ?= amd64 armhf powerpc 3 | BASE_ARCH ?= amd64 4 | 5 | 6 | build: tmp-$(TARGET)/Dockerfile 7 | docker build --no-cache -t multiarch-dockerfile:$(TARGET)-methode tmp-$(TARGET) 8 | docker run --rm multiarch-dockerfile:$(TARGET)-methode uname -a 9 | docker run --rm multiarch-dockerfile:$(TARGET)-methode ls -la /usr/bin/wget 10 | docker run --rm multiarch-dockerfile:$(TARGET)-methode ls -la /overlay 11 | 12 | 13 | tmp-$(TARGET)/Dockerfile: Dockerfile $(shell find overlay-common overlay-$(TARGET)) 14 | rm -rf tmp-$(TARGET) 15 | mkdir tmp-$(TARGET) 16 | cp Dockerfile $@ 17 | cp -rf overlay-common tmp-$(TARGET)/ 18 | cp -rf overlay-$(TARGET) tmp-$(TARGET)/ 19 | for arch in $(ARCHS); do \ 20 | if [ "$$arch" != "$(TARGET)" ]; then \ 21 | sed -i "/arch=$$arch/d" $@; \ 22 | fi; \ 23 | done 24 | sed -i '/#[[:space:]]*arch=$(TARGET)/s/^#//' $@ 25 | sed -i 's/#[[:space:]]*arch=$(TARGET)//g' $@ 26 | sed -i 's/#[[:space:]]*arch=$(TARGET)//g' $@ 27 | cat $@ 28 | -------------------------------------------------------------------------------- /method-d/README.md: -------------------------------------------------------------------------------- 1 | ````docker build --no-cache -t multiarch-dockerfile:amd64-methode tmp-amd64 2 | Sending build context to Docker daemon 5.12 kB 3 | Step 1 : FROM multiarch/ubuntu-debootstrap:amd64-wily 4 | ---> b5f39c8c167e 5 | Step 2 : ARG ARCH 6 | ---> Running in be897279dc64 7 | ---> 3477505d21ba 8 | Removing intermediate container be897279dc64 9 | Step 3 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 10 | ---> Running in e2240b74d258 11 | Get:1 http://archive.ubuntu.com wily InRelease [218 kB] 12 | Get:2 http://archive.ubuntu.com wily-updates InRelease [64.4 kB] 13 | Get:3 http://archive.ubuntu.com wily-security InRelease [64.4 kB] 14 | Get:4 http://archive.ubuntu.com wily/main amd64 Packages [1833 kB] 15 | Get:5 http://archive.ubuntu.com wily-updates/main amd64 Packages [117 kB] 16 | Get:6 http://archive.ubuntu.com wily-security/main amd64 Packages [74.9 kB] 17 | Fetched 2371 kB in 1s (1585 kB/s) 18 | Reading package lists... 19 | Reading package lists... 20 | Building dependency tree... 21 | Reading state information... 22 | wget is already the newest version. 23 | 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 24 | ---> 9914562f4006 25 | Removing intermediate container e2240b74d258 26 | Step 4 : RUN [ "${ARCH}" = "amd64" ] || echo "Special build instruction for amd64" 27 | ---> Running in 13e85c7c13a5 28 | Special build instruction for amd64 29 | ---> da8fb4c8ad98 30 | Removing intermediate container 13e85c7c13a5 31 | Step 5 : ADD overlay-common /overlay 32 | ---> 465dd0455c94 33 | Removing intermediate container fa44fb36def4 34 | Step 6 : ADD overlay-amd64 /overlay 35 | ---> 70d10609b712 36 | Removing intermediate container ac5fc0eddfcb 37 | Step 7 : CMD uname -a; cowsay hello world 38 | ---> Running in 41670bd10f84 39 | ---> 37602ccf0e43 40 | Removing intermediate container 41670bd10f84 41 | Successfully built 37602ccf0e43 42 | docker run --rm multiarch-dockerfile:amd64-methode uname -a 43 | Linux 2bf596e00437 4.2.5-1-ARCH #1 SMP PREEMPT Tue Oct 27 08:13:28 CET 2015 x86_64 x86_64 x86_64 GNU/Linux 44 | docker run --rm multiarch-dockerfile:amd64-methode ls -la /usr/bin/wget 45 | -rwxr-xr-x 33 root root 454176 Jan 13 2015 /usr/bin/wget 46 | docker run --rm multiarch-dockerfile:amd64-methode ls -la /overlay 47 | total 16 48 | drwxr-xr-x 2 root root 4096 Dec 7 18:40 . 49 | drwxr-xr-x 1 root root 4096 Dec 7 18:40 .. 50 | -rw-r--r-- 2 root root 6 Dec 7 18:39 amd64 51 | -rw-r--r-- 3 root root 7 Dec 7 18:39 common 52 | ``` 53 | -------------------------------------------------------------------------------- /method-d/overlay-amd64/amd64: -------------------------------------------------------------------------------- 1 | amd64 2 | -------------------------------------------------------------------------------- /method-d/overlay-armhf/armhf: -------------------------------------------------------------------------------- 1 | armhf 2 | -------------------------------------------------------------------------------- /method-d/overlay-common/common: -------------------------------------------------------------------------------- 1 | common 2 | -------------------------------------------------------------------------------- /method-d/overlay-powerpc/powerpc: -------------------------------------------------------------------------------- 1 | powerpc 2 | -------------------------------------------------------------------------------- /method-e/.gitignore: -------------------------------------------------------------------------------- 1 | tmp-*/ -------------------------------------------------------------------------------- /method-e/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM multiarch/ubuntu-debootstrap:amd64-wily # arch=amd64 2 | #FROM multiarch/ubuntu-debootstrap:armhf-wily # arch=armhf 3 | #FROM multiarch/ubuntu-debootstrap:powerpc-wily # arch=powerpc 4 | 5 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 6 | 7 | RUN echo "I'm amd64" # arch=amd64 8 | #RUN echo "I'm arhmf" # arch=armhf 9 | #RUN echo "I'm powerpc" # arch=powerpc 10 | 11 | ADD overlay-common /overlay 12 | ADD overlay-amd64 /overlay # arch=amd64 13 | #ADD overlay-armhf /overlay # arch=armhf 14 | #ADD overlay-powerpc /overlay # arch=powerpc 15 | 16 | CMD ["uname -a; cowsay hello world"] 17 | -------------------------------------------------------------------------------- /method-e/Makefile: -------------------------------------------------------------------------------- 1 | TARGET ?= amd64 2 | ARCHS ?= amd64 armhf powerpc 3 | BASE_ARCH ?= amd64 4 | 5 | 6 | build: tmp-$(TARGET)/Dockerfile 7 | docker build --no-cache -t multiarch-dockerfile:$(TARGET)-methode tmp-$(TARGET) 8 | docker run --rm multiarch-dockerfile:$(TARGET)-methode uname -a 9 | docker run --rm multiarch-dockerfile:$(TARGET)-methode ls -la /usr/bin/wget 10 | docker run --rm multiarch-dockerfile:$(TARGET)-methode ls -la /overlay 11 | 12 | 13 | tmp-$(TARGET)/Dockerfile: Dockerfile $(shell find overlay-common overlay-$(TARGET)) 14 | rm -rf tmp-$(TARGET) 15 | mkdir tmp-$(TARGET) 16 | cp Dockerfile $@ 17 | cp -rf overlay-common tmp-$(TARGET)/ 18 | cp -rf overlay-$(TARGET) tmp-$(TARGET)/ 19 | for arch in $(ARCHS); do \ 20 | if [ "$$arch" != "$(TARGET)" ]; then \ 21 | sed -i "/arch=$$arch/d" $@; \ 22 | fi; \ 23 | done 24 | sed -i '/#[[:space:]]*arch=$(TARGET)/s/^#//' $@ 25 | sed -i 's/#[[:space:]]*arch=$(TARGET)//g' $@ 26 | cat $@ 27 | -------------------------------------------------------------------------------- /method-e/README.md: -------------------------------------------------------------------------------- 1 | ```console 2 | root@fwrz:~/dockerfile/method-e# make TARGET=powerpc 3 | docker build --no-cache -t multiarch-dockerfile:powerpc-methode tmp-powerpc 4 | Sending build context to Docker daemon 5.12 kB 5 | Step 1 : FROM multiarch/ubuntu-debootstrap:powerpc-wily 6 | ---> 6c3238952754 7 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 8 | ---> Running in 1a2f37e8f2b5 9 | Reading package lists... 10 | Reading package lists... 11 | Building dependency tree... 12 | wget is already the newest version. 13 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 14 | ---> 9bb484d3dfed 15 | Removing intermediate container 1a2f37e8f2b5 16 | Step 3 : RUN echo "I'm powerpc" 17 | ---> Running in 5acf39b9da6b 18 | I'm powerpc 19 | ---> 350bd01dc34d 20 | Removing intermediate container 5acf39b9da6b 21 | Step 4 : ADD overlay-common /overlay 22 | ---> ea6f628eac5c 23 | Removing intermediate container a20b10a0b399 24 | Step 5 : ADD overlay-powerpc /overlay 25 | ---> 60362e31754f 26 | Removing intermediate container ee4e6484b525 27 | Step 6 : CMD uname -a; cowsay hello world 28 | ---> Running in d6ad695847aa 29 | ---> 6f758d35065d 30 | Removing intermediate container d6ad695847aa 31 | Successfully built 6f758d35065d 32 | docker run --rm multiarch-dockerfile:powerpc-methode uname -a 33 | Linux 30e2dd7ac3cb 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 ppc ppc ppc GNU/Linux 34 | docker run --rm multiarch-dockerfile:powerpc-methode ls -la /usr/bin/wget 35 | -rwxr-xr-x 1 root root 481776 Jan 13 2015 /usr/bin/wget 36 | docker run --rm multiarch-dockerfile:powerpc-methode ls -la /overlay 37 | total 16 38 | drwxr-xr-x 2 root root 4096 Dec 7 18:13 . 39 | drwxr-xr-x 34 root root 4096 Dec 7 18:13 .. 40 | -rw-r--r-- 1 root root 7 Dec 7 18:12 common 41 | -rw-r--r-- 1 root root 8 Dec 7 18:12 powerpc 42 | ``` 43 | 44 | ```console 45 | root@fwrz:~/dockerfile/method-e# make TARGET=amd64 46 | docker build --no-cache -t multiarch-dockerfile:amd64-methode tmp-amd64 47 | Sending build context to Docker daemon 5.12 kB 48 | Step 1 : FROM multiarch/ubuntu-debootstrap:amd64-wily 49 | ---> 0fdd22782955 50 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 51 | ---> Running in 39b4c4f04142 52 | Get:1 http://archive.ubuntu.com wily InRelease [218 kB] 53 | Get:2 http://archive.ubuntu.com wily-updates InRelease [64.4 kB] 54 | Get:3 http://archive.ubuntu.com wily-security InRelease [64.4 kB] 55 | Get:4 http://archive.ubuntu.com wily/main amd64 Packages [1833 kB] 56 | Get:5 http://archive.ubuntu.com wily-updates/main amd64 Packages [117 kB] 57 | Get:6 http://archive.ubuntu.com wily-security/main amd64 Packages [74.9 kB] 58 | Fetched 2371 kB in 2s (803 kB/s) 59 | Reading package lists... 60 | Reading package lists... 61 | Building dependency tree... 62 | Reading state information... 63 | wget is already the newest version. 64 | 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 65 | ---> d95c4d8cb401 66 | Removing intermediate container 39b4c4f04142 67 | Step 3 : RUN echo "I'm amd64" 68 | ---> Running in 6f692e30b8ea 69 | I'm amd64 70 | ---> a441f20535ce 71 | Removing intermediate container 6f692e30b8ea 72 | Step 4 : ADD overlay-common /overlay 73 | ---> 99ef90b38e25 74 | Removing intermediate container 5859e5f5a98a 75 | Step 5 : ADD overlay-amd64 /overlay 76 | ---> 737c67db1b05 77 | Removing intermediate container 5be623b9bc0b 78 | Step 6 : CMD uname -a; cowsay hello world 79 | ---> Running in 37cb71325694 80 | ---> 2e362ce51120 81 | Removing intermediate container 37cb71325694 82 | Successfully built 2e362ce51120 83 | docker run --rm multiarch-dockerfile:amd64-methode uname -a 84 | Linux 0948382423c4 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux 85 | docker run --rm multiarch-dockerfile:amd64-methode ls -la /usr/bin/wget 86 | -rwxr-xr-x 1 root root 454176 Jan 13 2015 /usr/bin/wget 87 | docker run --rm multiarch-dockerfile:amd64-methode ls -la /overlay 88 | total 16 89 | drwxr-xr-x 2 root root 4096 Dec 7 18:14 . 90 | drwxr-xr-x 36 root root 4096 Dec 7 18:14 .. 91 | -rw-r--r-- 1 root root 6 Dec 7 18:12 amd64 92 | -rw-r--r-- 1 root root 7 Dec 7 18:12 common 93 | ``` 94 | 95 | ```console 96 | root@fwrz:~/dockerfile/method-e# make TARGET=armhf 97 | docker build --no-cache -t multiarch-dockerfile:armhf-methode tmp-armhf 98 | Sending build context to Docker daemon 5.12 kB 99 | Step 1 : FROM multiarch/ubuntu-debootstrap:armhf-wily 100 | ---> aeed111b7935 101 | Step 2 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 102 | ---> Running in a62451ee370e 103 | Reading package lists... 104 | Reading package lists... 105 | Building dependency tree... 106 | wget is already the newest version. 107 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 108 | ---> cfcfd5e10d47 109 | Removing intermediate container a62451ee370e 110 | Step 3 : RUN echo "I'm arhmf" 111 | ---> Running in 3f55f07332cc 112 | I'm arhmf 113 | ---> 82ba3395a7a0 114 | Removing intermediate container 3f55f07332cc 115 | Step 4 : ADD overlay-common /overlay 116 | ---> 32123b3c5676 117 | Removing intermediate container 4fc4516ee59a 118 | Step 5 : ADD overlay-armhf /overlay 119 | ---> 857eb60044bb 120 | Removing intermediate container a2fb3806b864 121 | Step 6 : CMD uname -a; cowsay hello world 122 | ---> Running in 8aa2464c294e 123 | ---> 24d7d8038f08 124 | Removing intermediate container 8aa2464c294e 125 | Successfully built 24d7d8038f08 126 | docker run --rm multiarch-dockerfile:armhf-methode uname -a 127 | Linux c30131858027 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 armv7l armv7l armv7l GNU/Linux 128 | docker run --rm multiarch-dockerfile:armhf-methode ls -la /usr/bin/wget 129 | -rwxr-xr-x 1 root root 330100 Jan 13 2015 /usr/bin/wget 130 | docker run --rm multiarch-dockerfile:armhf-methode ls -la /overlay 131 | total 16 132 | drwxr-xr-x 2 root root 4096 Dec 7 18:14 . 133 | drwxr-xr-x 34 root root 4096 Dec 7 18:14 .. 134 | -rw-r--r-- 1 root root 6 Dec 7 18:12 armhf 135 | -rw-r--r-- 1 root root 7 Dec 7 18:12 common 136 | ``` 137 | -------------------------------------------------------------------------------- /method-e/overlay-amd64/amd64: -------------------------------------------------------------------------------- 1 | amd64 2 | -------------------------------------------------------------------------------- /method-e/overlay-armhf/armhf: -------------------------------------------------------------------------------- 1 | armhf 2 | -------------------------------------------------------------------------------- /method-e/overlay-common/common: -------------------------------------------------------------------------------- 1 | common 2 | -------------------------------------------------------------------------------- /method-e/overlay-powerpc/powerpc: -------------------------------------------------------------------------------- 1 | powerpc 2 | -------------------------------------------------------------------------------- /method-f/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | ARG ARCH=amd64 3 | 4 | # FROM multiarch/ubuntu-debootstrap:$ARCH-wily 5 | # sadly, it does not work :( 6 | FROM multiarch/ubuntu-debootstrap:armhf-wily 7 | 8 | RUN apt-get update && apt-get install --no-install-recommends -y -q wget 9 | 10 | RUN echo "I'm ${ARCH}" 11 | 12 | RUN case "${ARCH}" in \ 13 | armhf) \ 14 | echo "This is specific to armhf" \ 15 | ;; \ 16 | amd64) \ 17 | echo "This is specific to amd64" \ 18 | ;; \ 19 | powerpc) \ 20 | echo "This is specific to powerpc" \ 21 | ;; \ 22 | *) \ 23 | echo "This is the default" \ 24 | ;; \ 25 | esac 26 | 27 | ADD overlay-common /overlay 28 | ADD overlay-${ARCH} /overlay 29 | 30 | CMD ["uname -a; cowsay hello world"] 31 | -------------------------------------------------------------------------------- /method-f/Makefile: -------------------------------------------------------------------------------- 1 | TARGET ?= amd64 2 | ARCHS ?= amd64 armhf powerpc 3 | BASE_ARCH ?= amd64 4 | 5 | 6 | build: 7 | docker build --build-arg ARCH=$(TARGET) --no-cache -t multiarch-dockerfile:$(TARGET)-methodf . 8 | docker run --rm multiarch-dockerfile:$(TARGET)-methodf uname -a 9 | docker run --rm multiarch-dockerfile:$(TARGET)-methodf ls -la /usr/bin/wget 10 | docker run --rm multiarch-dockerfile:$(TARGET)-methodf ls -la /overlay 11 | -------------------------------------------------------------------------------- /method-f/README.md: -------------------------------------------------------------------------------- 1 | ```console 2 | root@fwrz:~/dockerfile/method-f# make TARGET=amd64 3 | docker build --build-arg ARCH=amd64 --no-cache -t multiarch-dockerfile:amd64-methodf . 4 | Sending build context to Docker daemon 16.38 kB 5 | Step 1 : FROM scratch 6 | ---> 7 | Step 2 : ARG ARCH=amd64 8 | ---> Running in de2cf54d1d83 9 | ---> ff7fabb6bfaa 10 | Removing intermediate container de2cf54d1d83 11 | Step 3 : FROM multiarch/ubuntu-debootstrap:armhf-wily 12 | ---> aeed111b7935 13 | Step 4 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 14 | ---> Running in 02251f961e4c 15 | Reading package lists... 16 | Reading package lists... 17 | Building dependency tree... 18 | wget is already the newest version. 19 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 20 | ---> 76ed85eb0b7e 21 | Removing intermediate container 02251f961e4c 22 | Step 5 : RUN echo "I'm ${ARCH}" 23 | ---> Running in 68b88ba364f3 24 | I'm amd64 25 | ---> f804a455a4d3 26 | Removing intermediate container 68b88ba364f3 27 | Step 6 : RUN case "${ARCH}" in armhf) echo "This is specific to armhf" ;; amd64) echo "This is specific to amd64" ;; powerpc) echo "This is specific to powerpc" ;; *) echo "This is the default" ;; esac 28 | ---> Running in 0bab0c22d991 29 | This is specific to amd64 30 | ---> 6f80ad5c11c2 31 | Removing intermediate container 0bab0c22d991 32 | Step 7 : ADD overlay-common /overlay 33 | ---> ddbeb546063c 34 | Removing intermediate container 4a02f31f7115 35 | Step 8 : ADD overlay-${ARCH} /overlay 36 | ---> 2b0919106171 37 | Removing intermediate container dd03a2578d38 38 | Step 9 : CMD uname -a; cowsay hello world 39 | ---> Running in ca4696e5f0c1 40 | ---> de098e3ce683 41 | Removing intermediate container ca4696e5f0c1 42 | Successfully built de098e3ce683 43 | docker run --rm multiarch-dockerfile:amd64-methodf uname -a 44 | Linux 594c0d47c886 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 armv7l armv7l armv7l GNU/Linux 45 | docker run --rm multiarch-dockerfile:amd64-methodf ls -la /usr/bin/wget 46 | -rwxr-xr-x 1 root root 330100 Jan 13 2015 /usr/bin/wget 47 | docker run --rm multiarch-dockerfile:amd64-methodf ls -la /overlay 48 | total 16 49 | drwxr-xr-x 2 root root 4096 Dec 7 19:21 . 50 | drwxr-xr-x 34 root root 4096 Dec 7 19:21 .. 51 | -rw-r--r-- 1 root root 6 Dec 7 18:59 amd64 52 | -rw-r--r-- 1 root root 7 Dec 7 18:59 common 53 | ``` 54 | 55 | ```console 56 | root@fwrz:~/dockerfile/method-f# make TARGET=armhf 57 | docker build --build-arg ARCH=armhf --no-cache -t multiarch-dockerfile:armhf-methodf . 58 | Sending build context to Docker daemon 16.38 kB 59 | Step 1 : FROM scratch 60 | ---> 61 | Step 2 : ARG ARCH=amd64 62 | ---> Running in 2ac0a1df618c 63 | ---> 0b295fe446eb 64 | Removing intermediate container 2ac0a1df618c 65 | Step 3 : FROM multiarch/ubuntu-debootstrap:armhf-wily 66 | ---> aeed111b7935 67 | Step 4 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 68 | ---> Running in 4b4ddd898b4a 69 | Reading package lists... 70 | Reading package lists... 71 | Building dependency tree... 72 | wget is already the newest version. 73 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 74 | ---> 9f184658e621 75 | Removing intermediate container 4b4ddd898b4a 76 | Step 5 : RUN echo "I'm ${ARCH}" 77 | ---> Running in ca561b4da7c9 78 | I'm armhf 79 | ---> 231a23be9306 80 | Removing intermediate container ca561b4da7c9 81 | Step 6 : RUN case "${ARCH}" in armhf) echo "This is specific to armhf" ;; amd64) echo "This is specific to amd64" ;; powerpc) echo "This is specific to powerpc" ;; *) echo "This is the default" ;; esac 82 | ---> Running in 1fc5e0b1d4fe 83 | This is specific to armhf 84 | ---> 607142c667e0 85 | Removing intermediate container 1fc5e0b1d4fe 86 | Step 7 : ADD overlay-common /overlay 87 | ---> 39fb23cfcd7b 88 | Removing intermediate container d315279e7a37 89 | Step 8 : ADD overlay-${ARCH} /overlay 90 | ---> 4a3d14ca1615 91 | Removing intermediate container cca2257dc19b 92 | Step 9 : CMD uname -a; cowsay hello world 93 | ---> Running in 7be6a8e8f848 94 | ---> 0f6deae0e3ef 95 | Removing intermediate container 7be6a8e8f848 96 | Successfully built 0f6deae0e3ef 97 | docker run --rm multiarch-dockerfile:armhf-methodf uname -a 98 | Linux a3a5d5e217c6 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 armv7l armv7l armv7l GNU/Linux 99 | docker run --rm multiarch-dockerfile:armhf-methodf ls -la /usr/bin/wget 100 | -rwxr-xr-x 1 root root 330100 Jan 13 2015 /usr/bin/wget 101 | docker run --rm multiarch-dockerfile:armhf-methodf ls -la /overlay 102 | total 16 103 | drwxr-xr-x 2 root root 4096 Dec 7 19:21 . 104 | drwxr-xr-x 34 root root 4096 Dec 7 19:21 .. 105 | -rw-r--r-- 1 root root 6 Dec 7 18:59 armhf 106 | -rw-r--r-- 1 root root 7 Dec 7 18:59 common 107 | ``` 108 | 109 | ```console 110 | root@fwrz:~/dockerfile/method-f# make TARGET=powerpc 111 | docker build --build-arg ARCH=powerpc --no-cache -t multiarch-dockerfile:powerpc-methodf . 112 | Sending build context to Docker daemon 16.38 kB 113 | Step 1 : FROM scratch 114 | ---> 115 | Step 2 : ARG ARCH=amd64 116 | ---> Running in d086f23132cf 117 | ---> e39d89a216ee 118 | Removing intermediate container d086f23132cf 119 | Step 3 : FROM multiarch/ubuntu-debootstrap:armhf-wily 120 | ---> aeed111b7935 121 | Step 4 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 122 | ---> Running in 36408769e6d5 123 | Reading package lists... 124 | Reading package lists... 125 | Building dependency tree... 126 | wget is already the newest version. 127 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 128 | ---> 84a1847468cd 129 | Removing intermediate container 36408769e6d5 130 | Step 5 : RUN echo "I'm ${ARCH}" 131 | ---> Running in 3d32b6b13d8b 132 | I'm powerpc 133 | ---> 5ebd149e599f 134 | Removing intermediate container 3d32b6b13d8b 135 | Step 6 : RUN case "${ARCH}" in armhf) echo "This is specific to armhf" ;; amd64) echo "This is specific to amd64" ;; powerpc) echo "This is specific to powerpc" ;; *) echo "This is the default" ;; esac 136 | ---> Running in 82de5a076a6b 137 | This is specific to powerpc 138 | ---> e4337210e313 139 | Removing intermediate container 82de5a076a6b 140 | Step 7 : ADD overlay-common /overlay 141 | ---> 0b8ca9d0ab46 142 | Removing intermediate container 6a285afb6744 143 | Step 8 : ADD overlay-${ARCH} /overlay 144 | ---> c3380b8abd34 145 | Removing intermediate container ad99e5fa1215 146 | Step 9 : CMD uname -a; cowsay hello world 147 | ---> Running in ca7a5966e6af 148 | ---> eaebadc010d8 149 | Removing intermediate container ca7a5966e6af 150 | Successfully built eaebadc010d8 151 | docker run --rm multiarch-dockerfile:powerpc-methodf uname -a 152 | Linux e1cfebadb742 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 armv7l armv7l armv7l GNU/Linux 153 | docker run --rm multiarch-dockerfile:powerpc-methodf ls -la /usr/bin/wget 154 | -rwxr-xr-x 1 root root 330100 Jan 13 2015 /usr/bin/wget 155 | docker run --rm multiarch-dockerfile:powerpc-methodf ls -la /overlay 156 | total 16 157 | drwxr-xr-x 2 root root 4096 Dec 7 19:22 . 158 | drwxr-xr-x 34 root root 4096 Dec 7 19:22 .. 159 | -rw-r--r-- 1 root root 7 Dec 7 18:59 common 160 | -rw-r--r-- 1 root root 8 Dec 7 18:59 powerpc 161 | ``` 162 | -------------------------------------------------------------------------------- /method-f/overlay-amd64/amd64: -------------------------------------------------------------------------------- 1 | amd64 2 | -------------------------------------------------------------------------------- /method-f/overlay-armhf/armhf: -------------------------------------------------------------------------------- 1 | armhf 2 | -------------------------------------------------------------------------------- /method-f/overlay-common/common: -------------------------------------------------------------------------------- 1 | common 2 | -------------------------------------------------------------------------------- /method-f/overlay-powerpc/powerpc: -------------------------------------------------------------------------------- 1 | powerpc 2 | -------------------------------------------------------------------------------- /method-g/.gitignore: -------------------------------------------------------------------------------- 1 | tmp-*/ -------------------------------------------------------------------------------- /method-g/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM multiarch/ubuntu-debootstrap:amd64-wily 2 | #FROM multiarch/ubuntu-debootstrap:armhf-wily # arch=armhf 3 | #FROM multiarch/ubuntu-debootstrap:powerpc-wily # arch=powerpc 4 | ARG ARCH=amd64 5 | 6 | RUN apt-get update \ 7 | && apt-get install --no-install-recommends -y -q wget 8 | 9 | RUN echo "I'm ${ARCH}" 10 | 11 | RUN case "${ARCH}" in \ 12 | armhf) \ 13 | echo "This is specific to armhf" \ 14 | ;; \ 15 | amd64) \ 16 | echo "This is specific to amd64" \ 17 | ;; \ 18 | powerpc) \ 19 | echo "This is specific to powerpc" \ 20 | ;; \ 21 | *) \ 22 | echo "This is the default" \ 23 | ;; \ 24 | esac 25 | 26 | 27 | ADD overlay-common /overlay 28 | ADD overlay-${ARCH} /overlay 29 | 30 | CMD ["uname -a; cowsay hello world"] 31 | -------------------------------------------------------------------------------- /method-g/Makefile: -------------------------------------------------------------------------------- 1 | TARGET ?= amd64 2 | ARCHS ?= amd64 armhf powerpc 3 | BASE_ARCH ?= amd64 4 | 5 | 6 | build: tmp-$(TARGET)/Dockerfile 7 | docker build --build-arg ARCH=$(TARGET) --no-cache -t multiarch-dockerfile:$(TARGET)-methodg tmp-$(TARGET) 8 | docker run --rm multiarch-dockerfile:$(TARGET)-methodg uname -a 9 | docker run --rm multiarch-dockerfile:$(TARGET)-methodg ls -la /usr/bin/wget 10 | docker run --rm multiarch-dockerfile:$(TARGET)-methodg ls -la /overlay 11 | 12 | 13 | tmp-$(TARGET)/Dockerfile: Dockerfile $(shell find overlay-common overlay-$(TARGET)) 14 | rm -rf tmp-$(TARGET) 15 | mkdir tmp-$(TARGET) 16 | cp Dockerfile $@ 17 | cp -rf overlay-common tmp-$(TARGET)/ 18 | cp -rf overlay-$(TARGET) tmp-$(TARGET)/ 19 | for arch in $(ARCHS); do \ 20 | if [ "$$arch" != "$(TARGET)" ]; then \ 21 | sed -i "/arch=$$arch/d" $@; \ 22 | fi; \ 23 | done 24 | sed -i '/#[[:space:]]*arch=$(TARGET)/s/^#//' $@ 25 | sed -i 's/#[[:space:]]*arch=$(TARGET)//g' $@ 26 | cat $@ 27 | -------------------------------------------------------------------------------- /method-g/README.md: -------------------------------------------------------------------------------- 1 | ```console 2 | root@fwrz:~/dockerfile/method-g# make TARGET=armhf 3 | Makefile:14: warning: overriding commands for target `build' 4 | Makefile:7: warning: ignoring old commands for target `build' 5 | docker build --build-arg ARCH=armhf --no-cache -t multiarch-dockerfile:armhf-methode tmp-armhf 6 | Sending build context to Docker daemon 5.632 kB 7 | Step 1 : FROM multiarch/ubuntu-debootstrap:amd64-wily 8 | ---> 0fdd22782955 9 | Step 2 : FROM multiarch/ubuntu-debootstrap:armhf-wily 10 | ---> aeed111b7935 11 | Step 3 : ARG ARCH=amd64 12 | ---> Running in 451f3fbc3238 13 | ---> 954f65bd0ecf 14 | Removing intermediate container 451f3fbc3238 15 | Step 4 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 16 | ---> Running in 5f9bf2cedad4 17 | Reading package lists... 18 | Reading package lists... 19 | Building dependency tree... 20 | wget is already the newest version. 21 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 22 | ---> 6f61bc67fa65 23 | Removing intermediate container 5f9bf2cedad4 24 | Step 5 : RUN echo "I'm ${ARCH}" 25 | ---> Running in 9547130ff96a 26 | I'm armhf 27 | ---> 760560e6f234 28 | Removing intermediate container 9547130ff96a 29 | Step 6 : RUN case "${ARCH}" in armhf) echo "This is specific to armhf" ;; amd64) echo "This is specific to amd64" ;; powerpc) echo "This is specific to powerpc" ;; *) echo "This is the default" ;; esac 30 | ---> Running in 577715f75884 31 | This is specific to armhf 32 | ---> 038d2990576d 33 | Removing intermediate container 577715f75884 34 | Step 7 : ADD overlay-common /overlay 35 | ---> 1dbae8e82685 36 | Removing intermediate container d6bf49a0b4e3 37 | Step 8 : ADD overlay-${ARCH} /overlay 38 | ---> 3e342d07f328 39 | Removing intermediate container 5c920f6e3225 40 | Step 9 : CMD uname -a; cowsay hello world 41 | ---> Running in 4cf61dc695e4 42 | ---> 612ce135a010 43 | Removing intermediate container 4cf61dc695e4 44 | Successfully built 612ce135a010 45 | docker run --rm multiarch-dockerfile:armhf-methode uname -a 46 | Linux f49278430139 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 armv7l armv7l armv7l GNU/Linux 47 | docker run --rm multiarch-dockerfile:armhf-methode ls -la /usr/bin/wget 48 | -rwxr-xr-x 1 root root 330100 Jan 13 2015 /usr/bin/wget 49 | docker run --rm multiarch-dockerfile:armhf-methode ls -la /overlay 50 | total 16 51 | drwxr-xr-x 2 root root 4096 Dec 7 20:03 . 52 | drwxr-xr-x 34 root root 4096 Dec 7 20:03 .. 53 | -rw-r--r-- 1 root root 6 Dec 7 19:53 armhf 54 | -rw-r--r-- 1 root root 7 Dec 7 19:53 common 55 | ``` 56 | 57 | ```console 58 | root@fwrz:~/dockerfile/method-g# make TARGET=powerpc 59 | Makefile:14: warning: overriding commands for target `build' 60 | Makefile:7: warning: ignoring old commands for target `build' 61 | docker build --build-arg ARCH=powerpc --no-cache -t multiarch-dockerfile:powerpc-methode tmp-powerpc 62 | Sending build context to Docker daemon 5.632 kB 63 | Step 1 : FROM multiarch/ubuntu-debootstrap:amd64-wily 64 | ---> 0fdd22782955 65 | Step 2 : FROM multiarch/ubuntu-debootstrap:powerpc-wily 66 | ---> 6c3238952754 67 | Step 3 : ARG ARCH=amd64 68 | ---> Running in 275158c418f9 69 | ---> f214d0c7aafd 70 | Removing intermediate container 275158c418f9 71 | Step 4 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 72 | ---> Running in a3995bce58db 73 | Reading package lists... 74 | Reading package lists... 75 | Building dependency tree... 76 | wget is already the newest version. 77 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 78 | ---> 18dd9aab21cc 79 | Removing intermediate container a3995bce58db 80 | Step 5 : RUN echo "I'm ${ARCH}" 81 | ---> Running in 5dda6c6e8194 82 | I'm powerpc 83 | ---> 115e5f611f4a 84 | Removing intermediate container 5dda6c6e8194 85 | Step 6 : RUN case "${ARCH}" in armhf) echo "This is specific to armhf" ;; amd64) echo "This is specific to amd64" ;; powerpc) echo "This is specific to powerpc" ;; *) echo "This is the default" ;; esac 86 | ---> Running in 9303e6975969 87 | This is specific to powerpc 88 | ---> 204a2a981fae 89 | Removing intermediate container 9303e6975969 90 | Step 7 : ADD overlay-common /overlay 91 | ---> 824dc2468e91 92 | Removing intermediate container e83b4329fe3e 93 | Step 8 : ADD overlay-${ARCH} /overlay 94 | ---> 95a7d0a11137 95 | Removing intermediate container 33860765a839 96 | Step 9 : CMD uname -a; cowsay hello world 97 | ---> Running in 48ba9fddb923 98 | ---> 10cd761df745 99 | Removing intermediate container 48ba9fddb923 100 | Successfully built 10cd761df745 101 | docker run --rm multiarch-dockerfile:powerpc-methode uname -a 102 | Linux e0e7d24e5f2f 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 ppc ppc ppc GNU/Linux 103 | docker run --rm multiarch-dockerfile:powerpc-methode ls -la /usr/bin/wget 104 | -rwxr-xr-x 1 root root 481776 Jan 13 2015 /usr/bin/wget 105 | docker run --rm multiarch-dockerfile:powerpc-methode ls -la /overlay 106 | total 16 107 | drwxr-xr-x 2 root root 4096 Dec 7 20:04 . 108 | drwxr-xr-x 34 root root 4096 Dec 7 20:04 .. 109 | -rw-r--r-- 1 root root 7 Dec 7 20:03 common 110 | -rw-r--r-- 1 root root 8 Dec 7 20:03 powerpc 111 | ``` 112 | 113 | ```console 114 | root@fwrz:~/dockerfile/method-g# make TARGET=amd64 115 | Makefile:14: warning: overriding commands for target `build' 116 | Makefile:7: warning: ignoring old commands for target `build' 117 | docker build --build-arg ARCH=amd64 --no-cache -t multiarch-dockerfile:amd64-methode tmp-amd64 118 | Sending build context to Docker daemon 5.632 kB 119 | Step 1 : FROM multiarch/ubuntu-debootstrap:amd64-wily 120 | ---> 0fdd22782955 121 | Step 2 : ARG ARCH=amd64 122 | ---> Running in 43400509900c 123 | ---> 45b55a6bb570 124 | Removing intermediate container 43400509900c 125 | Step 3 : RUN apt-get update && apt-get install --no-install-recommends -y -q wget 126 | ---> Running in 3c3a1233ce61 127 | Get:1 http://archive.ubuntu.com wily InRelease [218 kB] 128 | Get:2 http://archive.ubuntu.com wily-updates InRelease [64.4 kB] 129 | Get:3 http://archive.ubuntu.com wily-security InRelease [64.4 kB] 130 | Get:4 http://archive.ubuntu.com wily/main amd64 Packages [1833 kB] 131 | Get:5 http://archive.ubuntu.com wily-updates/main amd64 Packages [117 kB] 132 | Get:6 http://archive.ubuntu.com wily-security/main amd64 Packages [74.9 kB] 133 | Fetched 2372 kB in 2s (801 kB/s) 134 | Reading package lists... 135 | Reading package lists... 136 | Building dependency tree... 137 | Reading state information... 138 | wget is already the newest version. 139 | 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 140 | ---> 539352645d82 141 | Removing intermediate container 3c3a1233ce61 142 | Step 4 : RUN echo "I'm ${ARCH}" 143 | ---> Running in 52bcfcdab0d5 144 | I'm amd64 145 | ---> bb337d0c145f 146 | Removing intermediate container 52bcfcdab0d5 147 | Step 5 : RUN case "${ARCH}" in armhf) echo "This is specific to armhf" ;; amd64) echo "This is specific to amd64" ;; powerpc) echo "This is specific to powerpc" ;; *) echo "This is the default" ;; esac 148 | ---> Running in be0d1c695aa2 149 | This is specific to amd64 150 | ---> d6babd5f5480 151 | Removing intermediate container be0d1c695aa2 152 | Step 6 : ADD overlay-common /overlay 153 | ---> 3cde78778c7a 154 | Removing intermediate container f51eb2d1a41d 155 | Step 7 : ADD overlay-${ARCH} /overlay 156 | ---> 9e281c6d9dc8 157 | Removing intermediate container 0315d12bdc6a 158 | Step 8 : CMD uname -a; cowsay hello world 159 | ---> Running in 24a4742d0e8e 160 | ---> c0ecdb82eeb2 161 | Removing intermediate container 24a4742d0e8e 162 | Successfully built c0ecdb82eeb2 163 | docker run --rm multiarch-dockerfile:amd64-methode uname -a 164 | Linux b4ebc5255408 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux 165 | docker run --rm multiarch-dockerfile:amd64-methode ls -la /usr/bin/wget 166 | -rwxr-xr-x 1 root root 454176 Jan 13 2015 /usr/bin/wget 167 | docker run --rm multiarch-dockerfile:amd64-methode ls -la /overlay 168 | total 16 169 | drwxr-xr-x 2 root root 4096 Dec 7 20:04 . 170 | drwxr-xr-x 36 root root 4096 Dec 7 20:04 .. 171 | -rw-r--r-- 1 root root 6 Dec 7 19:53 amd64 172 | -rw-r--r-- 1 root root 7 Dec 7 19:53 common 173 | ``` 174 | -------------------------------------------------------------------------------- /method-g/overlay-amd64/amd64: -------------------------------------------------------------------------------- 1 | amd64 2 | -------------------------------------------------------------------------------- /method-g/overlay-armhf/armhf: -------------------------------------------------------------------------------- 1 | armhf 2 | -------------------------------------------------------------------------------- /method-g/overlay-common/common: -------------------------------------------------------------------------------- 1 | common 2 | -------------------------------------------------------------------------------- /method-g/overlay-powerpc/powerpc: -------------------------------------------------------------------------------- 1 | powerpc 2 | -------------------------------------------------------------------------------- /method-h/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | ARG FROM_IMAGE=multiarch/ubuntu-debootstrap:amd64-wily 3 | ARG ARCH=amd64 4 | # 5 | # We need to patch docker to handle ARG before FROM 6 | # 7 | FROM ${FROM_IMAGE} 8 | 9 | 10 | RUN apt-get update \ 11 | && apt-get install --no-install-recommends -y -q wget 12 | 13 | RUN echo "I'm ${ARCH}" 14 | 15 | RUN case "${ARCH}" in \ 16 | armhf) \ 17 | echo "This is specific to armhf" \ 18 | ;; \ 19 | amd64) \ 20 | echo "This is specific to amd64" \ 21 | ;; \ 22 | powerpc) \ 23 | echo "This is specific to powerpc" \ 24 | ;; \ 25 | *) \ 26 | echo "${ARCH} not supported yet" \ 27 | ;; \ 28 | esac 29 | 30 | 31 | ADD overlay-common /overlay 32 | ADD overlay-${ARCH} /overlay 33 | 34 | CMD ["uname -a; cowsay hello world"] 35 | -------------------------------------------------------------------------------- /method-h/Makefile: -------------------------------------------------------------------------------- 1 | TARGET ?= amd64 2 | FROM_IMAGE ?= multiarch/ubuntu-debootstrap:${TARGET}-wily 3 | # here we can use a dynamic FROM_IMAGE without regularity in the name 4 | 5 | build: 6 | docker build --build-arg "ARCH=$(TARGET)" --build-arg "FROM_IMAGE=$(FROM_IMAGE)" --no-cache -t multiarch-dockerfile:$(TARGET)-methodh . 7 | docker run --rm multiarch-dockerfile:$(TARGET)-methodh uname -a 8 | docker run --rm multiarch-dockerfile:$(TARGET)-methodh ls -la /usr/bin/wget 9 | docker run --rm multiarch-dockerfile:$(TARGET)-methodh ls -la /overlay 10 | -------------------------------------------------------------------------------- /method-h/README.md: -------------------------------------------------------------------------------- 1 | Soon I must patch Docker 2 | -------------------------------------------------------------------------------- /method-h/overlay-amd64/amd64: -------------------------------------------------------------------------------- 1 | amd64 2 | -------------------------------------------------------------------------------- /method-h/overlay-armhf/armhf: -------------------------------------------------------------------------------- 1 | armhf 2 | -------------------------------------------------------------------------------- /method-h/overlay-common/common: -------------------------------------------------------------------------------- 1 | common 2 | -------------------------------------------------------------------------------- /method-h/overlay-powerpc/powerpc: -------------------------------------------------------------------------------- 1 | powerpc 2 | --------------------------------------------------------------------------------