编译跨平台 Docker 镜像

购入 M2 芯片的 Mac 之后在 Mac 上编译的镜像是 ARM 架构的,没有办法在 AMD64 的服务器上运行。 下面是如何编译跨平台 Docker 镜像的办法。 什么是 docker buildx buildx 是一个 Docker CLI 插件,用于使用 BuildKit 扩展构建功能。可以简单地看成是 docker build 的加强版。 https://github.com/docker/buildx#set-buildx-as-the-default-builder Mac 版的 Docker Desktop 已经内建了这个功能,所以不需要另外安装。 创建一个构建器实例 开始之前可以用 docker buildx ls 查看当前的构建器实例 # docker buildx ls NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS default * docker default default running 23.0.5 linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6 desktop-linux docker desktop-linux desktop-linux running 23....

2023-05-03

使用GPG管理Yubikey密钥

前不久入手了一块 Yubikey,主要是用来为日常的账号做二次验证用。不过 Yubikey 除了用作二次验证的物理设备之外还可以充当智能卡,往里面放密钥。现在 Yubikey 不仅支持 RSA,还支持 ECC ,感觉拿来做日常加密签名还是不错的。 不过本人环境现在主要是 Windows,按官方文档在 Windows 下安装的 Gpg4win 在生成 ECC 密钥的时候会出现以下警告: warning: lower 3 bits of the secret key are not cleared 在网站搜了一遍之后似乎是密钥的低3位需要清零来保证它是8的倍数,避免被攻击。 (参考网址:https://crypto.stackexchange.com/questions/12425/why-are-the-lower-3-bits-of-curve25519-ed25519-secret-keys-cleared-during-creati) 不过解决方案尚未查到,只能规避,不在 Windows 环境下生成密钥。 所以密钥是在 WSL2(Debian) 下生成,然后将密钥导入 Yubikey 是在 Windows 下完成的。 安装GnuPG https://gnupg.org/download/index.html Windows 和 WSL2 下都要装。Windows 就装 Gpg4win,WSL2 下就用 apt 安装。 # apt install gpg 生成密钥 Windows 的硬盘会被挂载到 WSL2 下的 /mnt 目录下,为了在 Windows 下可以获取成生的密钥,这里以 D 盘为例,在 /mnt/d 目录下生成密钥。 # mkdir -p /mnt/d/gpg # cd /mnt/d/gpg # gpg --full-gen-key 按照提示生成密钥即可,我在 2....

2022-04-24

Kubernetes学习笔记:环境搭建

这篇文章记录了k8s的环境搭建步骤,除了node节点上不用安装网络插件以外。master和node节点的环境塔建几乎都是一样的。 准备工作 关闭swap # swapoff -a 同时还需要在/etc/fstab里注释掉swap那一行 关闭防火墙 # systemctl stop firewalld # systemctl disable firewalld 如果你不想关闭防火墙,可以打开kubernetes的官方文档所写的端口。 允许 iptables 检查桥接流量 # cat <<EOF | tee /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 EOF # modprobe br_netfilter # cat <<EOF | tee /etc/modules-load.d/k8s.conf br_netfilter EOF # sysctl --system 安装kubelet/kubeadm/kubectl 请按照官方文档来,这里就不搬运了。 https://kubernetes.io/zh/docs/setup/production-environment/tools/kubeadm/install-kubeadm/ 安装完之后看看kubeadm是什么版本 # kubeadm version kubeadm version: &version.Info{Major:1, Minor:22, GitVersion:v1.22.2, GitCommit:8b5a19147530eaac9476b0ab82980b4088bbc1b2, GitTreeState:clean, BuildDate:2021-09-15T21:37:34Z, GoVersion:go1.16.8, Compiler:gc, Platform:linux/amd64} 比如我这里安装的是1.22版本的,后面安装CRI-O的时候也要装1.22版本的。 最后把kubelet设为开机运行...

2021-09-25

Kubernetes学习笔记:概念合集

此文仅仅以个人的角度整理一些零碎的资料来帮助学习k8s CRI 全称Container Runtime Interface,容器运行时接口。定义了k8s与容器运行时通信的API。 OCI 全称Open Container Initiative,开放容器计划。OCI的官方网站(https://opencontainers.org/)主页有这么一段说明。简单来说就是一套开源的关于容器运行时和镜像的规范。由Docker和一些容器领域的领头在2015年发起的项目。 Open Container Initiative The Open Container Initiative is an open governance structure for the express purpose of creating open industry standards around container formats and runtimes. Established in June 2015 by Docker and other leaders in the container industry, the OCI currently contains two specifications: the Runtime Specification (runtime-spec) and the Image Specification (image-spec). The Runtime Specification outlines how to run a “filesystem bundle” that is unpacked on disk....

2021-09-24

Gitea + Drone 实现持续集成与持续交付

本文介绍了在将服务器内核从 4.9 版本升级到 4.15 版本后,由于缺失硬盘驱动无法引导的故障排除过程。作者通过重构 initramfs 并加入硬盘驱动解决了问题。

2020-02-03