Search code examples
dockerkubernetesgoogle-container-registrykube-proxy

Why does the k8s.gcr.io/kube-proxy Docker image 'work' on multiple architectures?


Running

docker run -it -v $PWD:/tmp k8s.gcr.io/kube-proxy:v1.15.1 cp /usr/local/bin/kube-proxy /tmp
file kube-proxy

gives a different result depending on which architecture I am on e.g. on CoreOS

Container Linux by CoreOS stable (2135.5.0)
core@node1 ~ $ file kube-proxy
kube-proxy: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

and on HypriotOS

HypriotOS/armv7: [email protected] in ~
$ file kube-proxy
kube-proxy: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped

How is this working?


Solution

  • Container runtimes are architecture aware & container registries support defining images for multiple architectures. Docker automatically pulls the correct image for the platform it's running on.

    https://blog.docker.com/2017/09/docker-official-images-now-multi-platform/