Riscv 系统类型如何移植docker.service
riscv 现有系统没有docker环境的源。手工移植二进制包的方式
- 安装有些依赖包
apt-get update
apt-get install gcc -y
apt-get install -y libcap-dev:riscv64 libyajl-dev:riscv64
apt-get install -y --no-install-recommends \
libyajl2 libcap2 iptables ca-certificates && \
update-alternatives --set iptables /usr/sbin/iptables-legacy
wget https://github.com/carlosedp/riscv-bringup/releases/download/v1.0/go1.17.linux-riscv64.tar.gz
tar zxvf go1.17.linux-riscv64.tar.gz
mv go /usr/local/
echo 'export PATH="$PATH:/usr/local/go/bin"' >> /etc/profile
source /etc/profile
go version
rm -rf go1.17.linux-riscv64.tar.gz
- 判断glibc
ldd --version
#ldd (Ubuntu GLIBC 2.31-0ubuntu9.9) 2.31
#Copyright (C) 2020 Free Software Foundation, Inc.
#This is free software; see the source for copying conditions. There is NO
#warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#Written by Roland McGrath and Ulrich Drepper.
2.1 glibc小于等于2.31
wget https://github.com/carlosedp/riscv-bringup/releases/download/v1.0/docker-19.03.8-dev_riscv64.tar.gz
mkdir docker-19.03
tar zxvf docker-19.03.8-dev_riscv64.tar.gz -C docker-19.03
cp docker-19.03/etc/systemd/system/* /etc/systemd/system
cp docker-19.03/usr/local/bin/* /usr/local/bin
cp docker-19.03/usr/local/include/* /usr/local/include
cp -r docker-19.03/usr/local/lib/* /usr/local/lib
cp docker-19.03/usr/local/share/man/man1/* /usr/local/share/man/man1 或
cp docker-19.03/usr/local/share/man/man1/* /usr/share/man/man1
cp docker-19.03/usr/local/share/man/man3/* /usr/local/share/man/man3 或
cp docker-19.03/usr/local/share/man/man3/* /usr/share/man/man3
cp -r docker-19.03/docker /etc/
2.2 glibc大于于2.31
wget https://github.com/carlosedp/riscv-bringup/releases/download/v1.0/docker-v20.10.2-dev_riscv64.tar.gz
mkdir docker-v20.10.2
tar zxvf docker-v20.10.2-dev_riscv64.tar.gz -C docker-v20.10.2
cp docker-v20.10.2/etc/systemd/system/* /etc/systemd/system
cp docker-v20.10.2/usr/local/bin/* /usr/local/bin
cp docker-v20.10.2/usr/local/sbin/* /usr/local/sbin
cp -r docker-v20.10.2/etc/docker /etc/
rm -rf docker-v20.10.2-dev_riscv64.tar.gz
3 安装CNI的插件
git clone https://github.com/containernetworking/plugins.git
cd plugins/
./build_linux.sh
mkdir -p /etc/cni/net.d
cat >/etc/cni/net.d/10-mynet.conf <<EOF
{
"cniVersion": "0.2.0",
"name": "mynet",
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"subnet": "10.22.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
]
}
}
EOF
cat >/etc/cni/net.d/99-loopback.conf <<EOF
{
"cniVersion": "0.2.0",
"name": "lo",
"type": "loopback"
}
EOF
echo 'export CNI_PATH="/root/plugins/bin"' >> /etc/profile
source /etc/profile
- 设置LD_LIBRARY_PATH
echo 'export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"' >> /etc/profile
source /etc/profile
/sbin/ldconfig
5.添加groupadd
groupadd docker
containerd >containerd.log 2>&1 &
systemctl enable docker