Debian12安装podman
前奏
更换国内源
rambo@debian:~$ sudo cat /etc/issue
Debian GNU/Linux 12 \n \l
rambo@debian:~$ cat /etc/apt/sources.list
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
安装podman
安装方法1
rambo@debian:~$ sudo apt -y update && sudo apt -y upgrade
rambo@debian:~$ sudo reboot -f
rambo@debian:~$ sudo apt install -y podman
rambo@debian:~$ podman version
Client: Podman Engine
Version: 4.7.1
API Version: 4.7.1
Go Version: go1.21.2
Built: Wed Dec 31 19:00:00 1969
OS/Arch: linux/amd64
# 卸载podman
sudo autoremove --purge podman
安装方法2
rambo@debian:~$ sudo apt install -y curl gpg gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates -y
rambo@debian:~$ source /etc/os-release
rambo@debian:~$ wget http://downloadcontent.opensuse.org/repositories/home:/alvistack/Debian_$VERSION_ID/Release.key -O alvistack_key
rambo@debian:~$ cat alvistack_key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/alvistack.gpg >/dev/null
rambo@debian:~$ echo "deb http://downloadcontent.opensuse.org/repositories/home:/alvistack/Debian_$VERSION_ID/ /" | sudo tee /etc/apt/sources.list.d/alvistack.list
rambo@debian:~$ sudo apt -y update
rambo@debian:~$ sudo apt install -y podman
rambo@debian:~$ podman version
安装后设置
rambo@debian:~$ sudo vim /etc/containers/registries.conf # 全局
# rambo@debian:~$ sudo vim ~/.config/containers/registries.conf # 本地
....
....
[[registry]]
prefix = "docker.io"
location = "docker.m.daocloud.io"
[[registry]]
prefix = "docker.io"
insecure = false
blocked = false
location = "docker.io"
[[registry.mirror]]
location = "hub-mirror.c.163.com"
[[registry.mirror]]
location = "registry.docker-cn.com"
示例1
rambo@debian:~$ podman pull docker.io/library/nginx:latest
rambo@debian:~$ podman images
rambo@debian:~$ vim Dockerfile
FROM ubuntu:20.04
RUN apt-get update -y
ENV DEBIAN_FRONTEND=noninteractive
RUN apt install -y gnupg apt-transport-https apt-utils wget
RUN echo "deb https://notesalexp.org/tesseract-ocr5/focal/ focal main" \
|tee /etc/apt/sources.list.d/notesalexp.list > /dev/null
RUN wget -O - https://notesalexp.org/debian/alexp_key.asc | apt-key add -
RUN apt-get update -y
RUN apt-get install tesseract-ocr -y
RUN apt install imagemagick -y
ENTRYPOINT ["tesseract"]
RUN tesseract -v
rambo@debian:~$ podman build . -t tesseract:latest
示例2
rambo@debian:~$ podman pull docker.io/library/debian
rambo@debian:~$ podman run -itd --name test1 docker.io/library/debian:latest
4fa90d389a5148474bed021f0568f1c060aa2e30ca82488a8d248edd3c05d8e8
rambo@debian:~$ podman exec -it test1 /bin/bash
root@4fa90d389a51:/# cat /etc/issue
Debian GNU/Linux 12 \n \l
做别名
rambo@debian:~$ echo '' | sudo tee /etc/containers/nodocker
rambo@debian:~$ echo "alias docker='/usr/bin/podman'" >> .bashrc
rambo@debian:~$ source .bashrc
关于docker镜像列表(非podman)
无需登录:
Azure 中国镜像 - https://dockerhub.azk8s.cn
科大镜像站 - https://docker.mirrors.ustc.edu.cn
七牛云 - https://reg-mirror.qiniu.com
网易云 - https://hub-mirror.c.163.com
腾讯云 - https://mirror.ccs.tencentyun.com
需登录:
DaoCloud - http://<your_code>.m.daocloud.io
阿里云 - https://<your_code>.mirror.aliyuncs.com
vim /etc/docker/daemon.json
{
"registry-mirrors": [
"https://docker.mirrors.ustc.edu.cn",
"https://reg-mirror.qiniu.com"
]
}
sudo systemctl daemon-reload
sudo systemctl restart docker
防走丢
QQ群1:905201396
QQ群2:756805267
QQ群3:912567610