Hi,
I was looking for a way to run a current version of Docker on my VisionFive board. As there are no pre-built packages yet (compared to Podman, which is already available via package manager) I’d need to build it from source.
Luckily I stumbled across build instructions dated last year but they are more or less still up to date:
I’ve been using a Lubuntu 21.10 image which is discussed in another thread: Lubuntu 21.10 image for Starfive VisionFive V1
As the flashed image only has a 10gb root partition I had to resize it otherwise I’d have ended in a no space left error.
Package-wise I’ve only installed the following:
sudo apt install build-essential cmake pkg-config libseccomp2 libseccomp-dev libdevmapper-dev golang libbtrfs-dev
Not quite sure which Go version is required as a minimum. Likely 16. I’ve used 17 and had no issues.
Steps to build all the necessary binaries, engine and CLI version 20.10.13 (don’t forget to set GOPATH first!):
mkdir -p $HOME/riscv-docker
cd $HOME/riscv-docker
#runc
git clone https://github.com/opencontainers/runc
pushd runc
make
sudo make install
popd
#containerd
git clone https://github.com/containerd/containerd
pushd containerd
make BUILDTAGS="no_btrfs"
sudo make install
popd
#docker-cli
mkdir -p $GOPATH/src/github.com/docker/
pushd $GOPATH/src/github.com/docker/
git clone https://github.com/docker/cli
pushd cli
git checkout v20.10.13
VERSION=20.10.13 DISABLE_WARN_OUTSIDE_CONTAINER=1 GO111MODULE=off GOOS=linux GOARCH=riscv64 make
sudo cp build/docker-linux-riscv64 /usr/local/bin
sudo ln -sf /usr/local/bin/docker-linux-riscv64 /usr/local/bin/docker
popd
popd
#docker-init
git clone https://github.com/krallin/tini
pushd tini
export CFLAGS="-DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37"
cmake . && make
sudo cp tini-static /usr/local/bin/docker-init
popd
#docker-proxy
mkdir -p $GOPATH/src/github.com/docker
pushd $GOPATH/src/github.com/docker
git clone https://github.com/docker/libnetwork/
pushd libnetwork
go get github.com/ishidawataru/sctp
GO111MODULE=off go build ./cmd/proxy
sudo cp proxy /usr/local/bin/docker-proxy
popd
popd
#rootlesskit
mkdir -p $GOPATH/src/github.com/rootless-containers/
pushd $GOPATH/src/github.com/rootless-containers/
git clone https://github.com/rootless-containers/rootlesskit.git
pushd rootlesskit
make
sudo make install
popd
popd
#dockerd
mkdir -p $GOPATH/src/github.com/docker/
pushd $GOPATH/src/github.com/docker/
git clone https://github.com/moby/moby docker
pushd docker
git checkout v20.10.13
sudo cp contrib/dockerd-rootless.sh /usr/local/bin
VERSION=20.10.13 DISABLE_WARN_OUTSIDE_CONTAINER=1 GO111MODULE=off GOOS=linux GOARCH=riscv64 ./hack/make.sh binary
sudo cp bundles/binary-daemon/dockerd-20.10.13 /usr/local/bin/dockerd
popd
popd
Took about an hour or more to compile all binaries. Systemd service files can be created as originally stated in the linked how-to.
One of the lasts steps would be to create a docker group, otherwise one of the systemd services did not start.
If nothing went wrong you’re greeted with this:
$ docker version
Client:
Version: 20.10.13
API version: 1.41
Go version: go1.17
Git commit: a224086349
Built: Sun Mar 20 18:35:08 2022
OS/Arch: linux/riscv64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.13
API version: 1.41 (minimum version 1.12)
Go version: go1.17
Git commit: 906f57ff5b
Built: Sun Mar 20 18:13:55 2022
OS/Arch: linux/riscv64
Experimental: false
containerd:
Version: v1.6.0-117-ged1a76270
GitCommit: ed1a762707cea5055dec47ed4b049159ac9f23a3
runc:
Version: 1.1.0+dev
GitCommit: v1.1.0-92-g98b75bef
docker-init:
Version: 0.19.0
GitCommit: 378bbbc