Build and export docker images as OCI for use with containerD on a Raspberry Pi.
Build and export an OCI image with buildx:
docker buildx build --platform=linux/arm/v7 --tag hello -o type=oci,dest=- . > hello.tar
NOTE: If you have buildkit installed, you can use that.
Copy the image to the pi:
scp ./hello.tar pi@raspberrypi.local:
On the pi, import the image with ctr
:
sudo ctr -n=example images import hello.tar
NOTE: We use the example
namespace, but could just use the default
one too.
The image should be available as docker.io/library/hello:latest
after imported.
Copy the main.go
file to the pi:
scp ./main.go pi@raspberrypi.local:
Build it:
go build main.go
And run it:
sudo ./main
Or build it locally and copy it to the pi:
GOARCH=arm GOOS=linux go build -o main ./main.go
scp ./main pi@raspberrypi.local:
sudo ./main