知乎专栏 |
目录
某些 Redhat 家族的 Linux 是自带 Podman,例如 Almalinux 9.0,RockyLinux没有自带 podman 需要自己安装,是方法执行下面的命令
[root@netkiller ~]# dnf install -y podman
初始化,启动 Podman
podman machine init podman machine start
操作演示
neo@MacBook-Pro-M2 ~ % podman machine init Downloading VM image: fedora-coreos-37.20221127.2.0-qemu.aarch64.qcow2.xz: done Extracting compressed file Image resized. Machine init complete To start your machine run: podman machine start neo@MacBook-Pro-M2 ~ % podman machine start Starting machine "podman-machine-default" Waiting for VM ... Mounting volume... /Users/neo:/Users/neo This machine is currently configured in rootless mode. If your containers require root permissions (e.g. ports < 1024), or if you run into compatibility issues with non-podman clients, you can switch using the following command: podman machine set --rootful API forwarding listening on: /Users/neo/.local/share/containers/podman/machine/podman-machine-default/podman.sock The system helper service is not installed; the default Docker API socket address can't be used by podman. If you would like to install it run the following commands: sudo /opt/homebrew/Cellar/podman/4.3.1/bin/podman-mac-helper install podman machine stop; podman machine start You can still connect Docker API clients by setting DOCKER_HOST using the following command in your terminal session: export DOCKER_HOST='unix:///Users/neo/.local/share/containers/podman/machine/podman-machine-default/podman.sock' Machine "podman-machine-default" started successfully
启用 socket
systemctl enable podman.socket systemctl start podman.socket systemctl status podman.socket
验证 sock 是否正常工作
[root@localhost ~]# curl -H "Content-Type: application/json" --unix-socket /run/podman/podman.sock http://localhost/_ping OK
此时可以使用 docker compose
[root@localhost ~]# ln -s /run/podman/podman.sock /var/run/docker.sock