iSulad部署以及使用方案

文章目录

部署isulad

系统版本:openEuler 22.03 LTS版本,建议用欧拉系统

一、基础安装

bash 复制代码
# 克隆地址
git clone https://gitee.com/openeuler/iSulad.git
# 重新安装依赖环境meson
sudo apt remove meson -y
sudo apt install -y python3-pip
pip3 install --user meson
# 运行测试版本
~/.local/bin/meson --version
export PATH="$HOME/.local/bin:$PATH"
# 安装依赖
sudo apt-get install -y libgmock-dev
# 安装1.7以上版本的go
wget https://go.dev/dl/go1.20.14.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.20.14.linux-amd64.tar.gz
echo 'export PATH=/usr/local/go/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# 安装依赖
sudo env "PATH=$PATH" bash -x CI/install_depends.sh
# 依赖最后如果有可以忽略:install_depends.sh: line 155: /root/.cargo/env: No such file or directory
# 更改权限执行安装
cd ~/iSulad
mkdir -p build
cd build

cmake .. \
  -DCMAKE_INSTALL_PREFIX=/usr \
  -DENABLE_LCR=OFF \
  -DENABLE_RUNC=ON

make -j$(nproc)
sudo make install

补充:

bash 复制代码
# 如果要重新编译
# 删除依赖项
sudo rm -rf /root/lcr
sudo rm -rf /root/lxc
sudo rm -rf /root/cri-tools
sudo rm -rf /root/dnsname
sudo rm -rf /root/plugins
# 停止服务
sudo systemctl stop isulad

# 1️⃣ 删二进制
sudo rm -f /usr/local/bin/isulad
sudo rm -f /usr/local/bin/isula

# 2️⃣ 删动态库(关键)
sudo rm -f /usr/local/lib/libisula*
sudo rm -f /usr/local/lib/liblcr*
sudo rm -f /usr/local/lib/libshim*

# 3️⃣ 刷新链接器缓存
sudo ldconfig

# 4️⃣ 清运行时数据(避免脏数据)
sudo rm -rf /var/lib/isulad
sudo rm -rf /run/isulad

二、修改配置文件

bash 复制代码
# 创建基础配置文件config.json,systemcontainer_config.json
mkdir -p /etc/default/isulad/
vim /etc/default/isulad/config.json
cp /etc/default/isulad/config.json /etc/default/isulad/systemcontainer_config.json
# 需要安装runc,用runc替换默认的runtime方案,所以按照如下config.json内容设置
sudo apt install runc

config.json文件内容

bash 复制代码
{
  "hook_spec": "/etc/isulad/hooks",
  "start_timeout": 120,
  "registry-mirrors": [
        "https://docker.1ms.run"
   ],
  "log_level": "INFO",
  "ociVersion": "1.0.2",
  "default_runtime": "runc",
  "runtimes": {
    "runc": {
      "path": "/usr/sbin/runc",
      "runtime_root": "/run/isulad/runc",
      "runtime": "runc"
    }
  }
}

三、配置成服务,service文件如下

bash 复制代码
[Unit]
Description=iSulad daemon
Documentation=https://gitee.com/openeuler/iSulad
After=network.target

[Service]
Type=simple

# 关键:前台运行
ExecStart=/usr/local/bin/isulad

# 自动重启
Restart=always
RestartSec=2

# 提高资源限制(避免容器启动异常)
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity

# cgroup(建议)
Delegate=yes

# kill 行为
KillMode=process

[Install]
WantedBy=multi-user.target

四、前台调试启动isulad

bash 复制代码
# 查询可执行文件位置
which isulad
# 运行测试
sudo strace -f -o /root/isulad.trace /usr/local/bin/isulad
# 查看是否启动
ps -ef | grep isulad
# 查看启动异常报错日志
sudo tail -50 /root/isulad.trace
# 查看系统运行日志
tail -200 /var/lib/isulad/isulad.log

使用

isulad是华为推出的一套通用容器引擎,使用方法同docker类似,需要配置镜像源,拉取镜像

修改镜像源

bash 复制代码
vim /etc/isulad/daemon.json
{
    "registry-mirrors": [
        "https://docker.m.daocloud.io",
        "https://docker.1panel.live"
    ]
}
bash 复制代码
# 拉取镜像
isula pull quay.io/rockylinux/rockylinux:8
# 查看镜像列表
sudo isula images
# 启动运行容器
sudo isula run -dit --net=host  --privileged --name isula_openfilter 镜像id  /bin/bash
# 查看是否运行
sudo isula ps
# 拷贝主机文件夹到容器root目录下
sudo isula cp 文件夹 容器id:/root/
# 进入容器
sudo isula exec -it 容器id /bin/bash
# 将正在运行的容器导出为文件
isula export -o export.tar 容器id
# 将tar镜像导入为本地镜像
isula import export.tar my-image:latest
相关推荐
桌面运维家1 天前
IDV云桌面vDisk机房网络管控访问限制部署方案
运维·服务器·网络
ShineWinsu1 天前
对于Linux:动静态库的制作与原理的解析—下
linux·运维·服务器·进程·链接·虚拟地址空间·
KKKlucifer1 天前
国内堡垒机如何打通云网运维安全一体化
运维·安全
wydd99_lll1 天前
docker特权模式下逃逸
运维·docker·容器
mseaspring1 天前
一款用于监控跨多台主机 Docker 容器的实时终端
运维·docker·容器
NineData1 天前
NineData 亮相香港国际创科展 InnoEX 2026,以 AI 加速布局全球市场
运维·数据库·人工智能·ninedata·新闻资讯·玖章算术
heimeiyingwang1 天前
【架构实战】Kubernetes日志收集:EFK/Loki架构
容器·架构·kubernetes
RisunJan1 天前
Linux命令-ngrep(方便的数据包匹配和显示工具)
linux·运维·服务器
热爱Liunx的丘丘人1 天前
Ansible-doc及常用模块
linux·运维·服务器·ansible
tianyuanwo1 天前
OS/DevOps程序员切入Harness Engineering的入门与进阶指南
运维·devops·harness