Docker CE is not supported in Ubuntu 24 for RISC-V, probably it will be soon for this support as is really easy to compile and use it.
Here are the instructions for make it work.
I've tested the following in OrangePi RV2 and qemu-riscv.
Note that I'm using static releases but shared should also work.
Also the configuration files through heredoc are directly from docker-ce packages so should work the same as official packages
dependencies
You need a compiler and make
:
sudo apt update && \
sudo apt install -y build-essential make
go
You need go
to compile docker, but the version in Ubuntu 24 is old to compile latest version, so can be setup directly from compiled binaries:
cd /tmp && \
wget https://go.dev/dl/go1.24.4.linux-riscv64.tar.gz && \
sudo tar -C /usr/local -xzf go1.24.4.linux-riscv64.tar.gz && \
rm -f go1.24.4.linux-riscv64.tar.gz
# set the path in bash or copy into /etc/profile or .bashrc
export PATH=$PATH:/usr/local/go/bin
runc
this is already compiled so just copy to your system
cd /tmp && /
wget -O runc https://github.com/opencontainers/runc/releases/download/v1.3.0/runc.riscv64 && \
chmod +x runc && \
sudo mv runc /usr/bin/
containerd
cd /tmp && \
wget -O containerd-2.1.3.tar.gz https://github.com/containerd/containerd/archive/refs/tags/v2.1.3.tar.gz && \
tar zxf containerd-2.1.3.tar.gz && \
cd containerd-2.1.3 && \
make VERSION=2 REVISION=1.3 static-release && \
sudo cp ./bin/containerd /usr/local/bin && \
sudo cp ./bin/containerd-shim-runc-v2 /usr/local/bin && \
sudo cp ./bin/ctr /usr/local/bin && \
sudo cp ./containerd.service /lib/systemd/system/ && \
{ cat <<-EOF > /tmp/config.toml
# Copyright 2018-2022 Docker Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
disabled_plugins = ["cri"]
#root = "/var/lib/containerd"
#state = "/run/containerd"
#subreaper = true
#oom_score = 0
#[grpc]
# address = "/run/containerd/containerd.sock"
# uid = 0
# gid = 0
#[debug]
# address = "/run/containerd/debug.sock"
# uid = 0
# gid = 0
# level = "info"
EOF
} && sudo mkdir -p /etc/containerd/ && \
sudo mv /tmp/config.toml /etc/containerd/ && \
sudo systemctl --system daemon-reload && \
sudo systemctl enable containerd && \
sudo systemctl start containerd && \
cd /tmp && \
rm -rf containerd-2.1.3 containerd-2.1.3.tar.gz
docker daemon (moby)
cd /tmp && \
wget -O moby-28.3.1.tar.gz https://github.com/moby/moby/archive/refs/tags/v28.3.1.tar.gz && \
tar -zxf moby-28.3.1.tar.gz && \
cd moby-28.3.1 && \
DOCKER_GITCOMMIT=5beb93de84f02bf7e167cbb87ce81355ddd8f560 ./hack/make.sh binary && \
sudo cp bundles/binary-daemon/* /usr/bin/ && \
sudo cp ./contrib/dockerd-rootless.sh /usr/bin/ && \
sudo cp ./contrib/dockerd-rootless-setuptool.sh /usr/bin/ && \
sudo mkdir -p /etc/docker && \
{ cat <<-EOF > /tmp/docker
# Docker SysVinit configuration file
#
# THIS FILE DOES NOT APPLY TO SYSTEMD
#
# Please see the documentation for "systemd drop-ins":
# https://docs.docker.com/engine/admin/systemd/
#
# Customize location of Docker binary (especially for development testing).
#DOCKERD="/usr/local/bin/dockerd"
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"
# This is also a handy place to tweak where Docker's temporary files go.
#export DOCKER_TMPDIR="/mnt/bigdrive/docker-tmp"
EOF
} && \
sudo mv /tmp/docker /etc/default/ && \
{ cat <<-EOF > /tmp/docker.socket
[Unit]
Description=Docker Socket for the API
[Socket]
# If /var/run is not implemented as a symlink to /run, you may need to
# specify ListenStream=/var/run/docker.sock instead.
ListenStream=/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target
EOF
} && sudo mv /tmp/docker.socket /usr/lib/systemd/system/ && \
{ cat <<-EOF > /tmp/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target nss-lookup.target docker.socket firewalld.service containerd.service time-set.target
Wants=network-online.target containerd.service
Requires=docker.socket
StartLimitBurst=3
StartLimitIntervalSec=60
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutStartSec=0
RestartSec=2
Restart=always
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
OOMScoreAdjust=-500
[Install]
WantedBy=multi-user.target
EOF
} && \
sudo mv /tmp/docker.service /usr/lib/systemd/system/ && \
sudo systemctl --system daemon-reload && \
sudo systemctl enable docker.socket docker.service && \
sudo systemctl start docker.socket docker.service && \
cd /tmp && \
rm -rf moby-28.3.1.tar.gz moby-28.3.1
docker-cli
With previous steps you will have docker daemon running in your system, but the easy way to interact is with docker-cli (or docker
command)
cd /tmp && \
wget -O cli-28.3.1.tar.gz https://github.com/docker/cli/archive/refs/tags/v28.3.1.tar.gz && \
tar -zxf cli-28.3.1.tar.gz && \
cd cli-28.3.1 && \
mkdir -p .gopath/src/github.com/docker && \
export GOPATH=/tmp/cli-28.3.1/.gopath && \
ln -s `pwd` .gopath/src/github.com/docker/cli && \
DISABLE_WARN_OUTSIDE_CONTAINER=1 make binary && \
sudo cp build/docker-linux-riscv64 /usr/bin && \
sudo cp build/docker /usr/bin && \
cd /tmp && \
rm -rf cli-28.3.1.tar.gz cli-28.3.1
docker-cli extensions
buildkit and docker compose are fundamental for any setup, so must be setup, good thing is that are already compiled for riscv, so just need to be copied into proper dir.
Note that documentation suggest a lot of possible local/global paths, /usr/libexec/docker/cli-plugins
worked for me, but feel free to setup other dirs if you need.
sudo mkdir -p /usr/libexec/docker/cli-plugins
# docker compose
cd /tmp && \
wget -O docker-compose https://github.com/docker/compose/releases/download/v2.38.2/docker-compose-linux-riscv64 && \
chmod +x docker-compose && \
sudo mv docker-compose /usr/libexec/docker/cli-plugins && \
wget -O docker-buildx https://github.com/docker/buildx/releases/download/v0.26.1/buildx-v0.26.1.linux-riscv64 && \
chmod +x docker-buildx && \
sudo mv docker-buildx /usr/libexec/docker/cli-plugins