摘要: 0.top指令和ps指令的CPU计算 top top指令显示为一段时间内的CPU使用率,通常为几秒 显示值可大于100%,表示多核占用的情况 用于排查CPU高负载进程 ps ps指令显示从开机到现在的平均CPU使用率 主要用于查看进程CPU资源占用 1.Linux下CPU使用率计算 1.1 获取CP 阅读全文
posted @ 2023-05-24 15:39 umichan 阅读(3100) 评论(0) 推荐(0)
  2025年8月23日
摘要: Packet定义 #include <stdint.h> #include <netinet/in.h> enum Direction { UNKNOWN = -1, INCOMING = 0, // Recv packet OUTGOING = 1, // Send packet }; struc 阅读全文
posted @ 2025-08-23 22:19 umichan 阅读(97) 评论(0) 推荐(0)
  2025年8月22日
摘要: 编译和运行环境分离 以C++项目为例,容器运行除了项目的二进制文件以外,还需要相关的依赖库,而运行环境中并不需要编译环境中的大部分依赖 # Compile FROM docker.io/library/ubuntu:latest AS builder # Install compile relate 阅读全文
posted @ 2025-08-22 16:14 umichan 阅读(13) 评论(0) 推荐(0)
  2025年8月8日
摘要: 使用buildah官方提供的镜像作为运行容器 docker pull quay.io/buildah/stable:latest 创建buildah容器,容器中可以执行pull/build/push 镜像的数据会存储到宿主机的/var/buildah目录下 sudo docker run -it \ 阅读全文
posted @ 2025-08-08 14:43 umichan 阅读(17) 评论(0) 推荐(0)
  2025年7月23日
摘要: chroot命令无法直接使用exec.Command调用,提示错误代码125或127 以查看宿主机磁盘的命令为例 package main import ( "fmt" "os/exec" "syscall" ) func main() { // Replace with your chroot p 阅读全文
posted @ 2025-07-23 11:29 umichan 阅读(30) 评论(0) 推荐(0)
  2024年5月11日
摘要: Header定义 // standard archive format - standard tar - ustar struct TarHeader { char name[100]; // 0 -99 char mode[8]; // 100-107 char uid[8]; // 108-11 阅读全文
posted @ 2024-05-11 11:27 umichan 阅读(292) 评论(0) 推荐(0)
  2024年4月18日
摘要: 运行进程时报错 ./main: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by ./main) ./main: /lib/x86_64-linux-gnu/libc.so.6: version 阅读全文
posted @ 2024-04-18 14:59 umichan 阅读(19886) 评论(2) 推荐(3)
  2024年2月20日
摘要: 报错找不到zsh Last login: Tue Feb 20 14:28:15 2024 from 192.168.102.123 usr/bin/zsh: No such file or directory Connection to 192.168.102.112 closed. 登录服务器发 阅读全文
posted @ 2024-02-20 15:21 umichan 阅读(144) 评论(0) 推荐(0)
  2024年2月6日
摘要: 基于containers/storage的镜像存储 镜像结构 完整镜像Image主要由Layer、Blob和Manifest组成 Layer:通过链式结构组成,存储镜像的数据,每个Layer依赖其Parent Layer,即使两个Layer的内容完全相同,Parent Layer不同也会导致Laye 阅读全文
posted @ 2024-02-06 16:32 umichan 阅读(13) 评论(0) 推荐(0)
摘要: 基于https实现镜像所有相关元信息的获取 在弱网环境下,下载镜像很慢且容易出错,基于这个原因需要开发更加可靠且支持断点续传的镜像下载程序 由于Docker Hub在国内无法访问,用自己的阿里云镜像加速替代来进行测试 下面以下载linux/amd64的ubuntu22.04镜像为例 Authenti 阅读全文
posted @ 2024-02-06 16:06 umichan 阅读(78) 评论(0) 推荐(0)
摘要: 调用的开源库引用了github个人仓库,如果作者删除了仓库或者改成私人仓库,那么go mod tidy就会失败 以github.com/mitchellh/osext为例,作者因为某些原因删除了仓库,并给出了替代的官方仓库github.com/kardianos/osext 使用replace命令 阅读全文
posted @ 2024-02-06 10:29 umichan 阅读(684) 评论(0) 推荐(0)