Sign inSign up

depau/docker-platformify

By depau

Updated over 5 years ago

Proxies the Docker API socket and injects a custom `platform` parameter

Image
0

227

depau/docker-platformify repository overview

Docker Platform-ify

Proxies the Docker API socket and injects a custom platform parameter whenever an image is pulled/created.

Screenshot

Warning

Industrial grade duct-tape!

duct tape duct tape

Usage

Since executables built for another architecture won't magically run on your machine on their own, you're gonna have to install qemu-user-static and ensure binfmt_misc is configured correctly, for example:

:qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-static:CF

Also, Docker needs to be started with the --experimental flag.

Note that this is equivalent to adding --platform yourvalue to the docker pull/ docker run commands, it just does it transparently. My use case is a CI runner that connects to Docker using the API without the command line.

Building
go build
Running
./docker-platformify /var/run/docker.sock /tmp/injected.sock linux/arm64
Change log level
./docker-platformify /var/run/docker.sock /tmp/injected.sock linux/arm64 DEBUG

License

GNU GPLv3.0

Please share your changes if you end up deploying this piece of duct tape on your premises :)

gif

Tag summary

Content type

Image

Digest

Size

4.6 MB

Last updated

over 5 years ago

docker pull depau/docker-platformify