å æ¥ã®åå¼·ä¼ã¨è³æã¯æ¬¡ã«æ²è¼ããã¦ãã¾ãããããé½åãã¤ãã°ã次åã®åå¼·ä¼ã«ãã²ãåå ãã ããã
å æ¥ã®åå¼·ä¼ã§Podmanãåãä¸ããããã®ã§ãæ©éã§ããã ãæ°ãããã¼ã¸ã§ã³ã®Podmanã使ã£ã¦ã¿ããã¨æãã¾ããã åãããªãã¨ãããã ãã¹ãã¹ãè¨ã£ã¦ãã¾ããããmacOSã§Podman Desktopã¯ä½¿ã£ã¦ãããã®ã®ãLinuxã§Podmanã使ãã®ã¯ä¹ ãã¶ãã§ãã Fedoraã®æ°ãããã¼ã¸ã§ã³ãåºããã³ã«æ¯åãã§ãã¯ã¯ãã¦ããã®ã§ããã©ãã
ä»åã¯Linuxãã£ã¹ããªãã¥ã¼ã·ã§ã³ã¯Fedora 40ã使ã£ã¦ãç¾æç¹ã§ææ°ã®Podmanãå°å ¥ãã¦ã¿ã¾ãã å®è¡ããçµæãFedora 40ã§ã¯Podman 5.1.1ã使ããããã§ãã
$ dnf info podman ... åå : podman ã¨ãã㯠: 5 ãã¼ã¸ã§ã³ : 5.1.1 ãªãªã¼ã¹ : 1.fc40 Arch : aarch64 ãµã¤ãº : 50 M ã½ã¼ã¹ : podman-5.1.1-1.fc40.src.rpm ãªãã¸ããªã¼ : @System repo ãã : updates æ¦è¦ : Manage Pods, Containers and Container Images URL : https://podman.io/ ã©ã¤ã»ã³ã¹ : Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 説æ : podman (Pod Manager) is a fully featured container engine that is a simple : daemonless tool. podman provides a Docker-CLI comparable command line that : eases the transition from other container engines and allows the management of : pods, containers and images. Simply put: alias docker=podman. : Most podman commands can be run as a regular user, without requiring : additional privileges. : : podman uses Buildah(1) internally to create container images. : Both tools share image (not container) storage, hence each can use or : manipulate images (but not containers) created by the other.
æ©éã¤ã³ã¹ãã¼ã«ãã¦ä½¿ã£ã¦ã¿ã¾ãã podman-dockerããã±ã¼ã¸ãåæã«ã¤ã³ã¹ãã¼ã«ãã¦ã¿ã¾ãããã®ããã±ã¼ã¸ã¯dockerã³ãã³ããpodmanã®ã³ãã³ãã«ç¿»è¨³ãã¦ãããåãããããã®ã§ãã
$ sudo dnf install -y podman podman-docker
ã§ã¯ã¾ããUbuntuã³ã³ãããåããã¦ã¿ã¾ãããã
$ podman run -it --rm ubuntu Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf) Trying to pull docker.io/library/ubuntu:latest... Getting image source signatures Copying blob eed1663d2238 done | Copying config ffb64c9b7e done | Writing manifest to image destination root@bfb6be3e85c7:/# root@bfb6be3e85c7:/# cat /etc/os-release PRETTY_NAME="Ubuntu 24.04 LTS" NAME="Ubuntu" VERSION_ID="24.04" VERSION="24.04 LTS (Noble Numbat)" VERSION_CODENAME=noble ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=noble LOGO=ubuntu-logo
åé¡ãªããã³ã³ãããå®è¡ã§ãã¾ããã ã³ã³ããã®ä¸ã¯Ubuntuãã®ã¾ãã¾ã§ãã
Podmanã®è¨å®ã¯/etc/containers/
ã®ä¸ã«æ ¼ç´ããã¦ããããã§ãã
詳細ã¯å¾è¿°ãã¾ãããè¨å®ã®ãã³ãã¬ã¼ãã¯/usr/share/containers
ã«ããã¾ãã
ã³ãã³ããå®è¡ããã¨ãã«ãåºåãããã¬ã¸ã¹ããªã¼ã®è¨å®ã®ä¸èº«ãè¦ã¦ã¿ã¾ãããã ãã¡ã¤ã«ãéãã¨ãè²ã ãªãã£ã¹ããªãã¥ã¼ã·ã§ã³ã®URLãããããã¨æ¸ããã¦ãã¾ãããã®è¨å®ã«ãããé©åãªã¬ã¸ã¹ããªã¼ããã³ã³ããã¼ã¤ã¡ã¼ã¸ãåå¾ãã¦ããããã§ããã¡ãã£ã¨å¤ãã£ã¦ã¾ããã
$ less /etc/containers/registries.conf.d/000-shortnames.conf [aliases] # almalinux "almalinux" = "docker.io/library/almalinux" "almalinux-minimal" = "docker.io/library/almalinux-minimal" # Amazon Linux "amazonlinux" = "public.ecr.aws/amazonlinux/amazonlinux" # Arch Linux "archlinux" = "docker.io/library/archlinux" # centos "centos" = "quay.io/centos/centos" ... # docker "alpine" = "docker.io/library/alpine" ... # Fedora "fedora-bootc" = "registry.fedoraproject.org/fedora-bootc" "fedora-minimal" = "registry.fedoraproject.org/fedora-minimal" "fedora" = "registry.fedoraproject.org/fedora" ... # Red Hat Enterprise Linux ... "ubi9" = "registry.access.redhat.com/ubi9" "ubi9-minimal" = "registry.access.redhat.com/ubi9-minimal" "ubi9-init" = "registry.access.redhat.com/ubi9-init" "ubi9-micro" = "registry.access.redhat.com/ubi9-micro" ... # Ubuntu "ubuntu" = "docker.io/library/ubuntu" ...
Dockerã®å ´åã¯ãæé»çã«Docker Hubã®ã¤ã¡ã¼ã¸ã使ãããã«è¨å®ããã¦ãã¾ãï¼è¨å®ã§å¤ãããã¾ãï¼ã ä¸æ¹Podmanã¯ãããããããã使ãããã§ãããã¤ã¡ã¼ã¸ã«ã¤ãã¦ã¯å®ç¾©ããã¦ãããé©åãªã¬ã¸ã¹ãã©ã¼ããç°¡åã«ã¤ã¡ã¼ã¸ãåå¾ã§ããããã«ãªã£ã¦ãã¾ãããè¨å®ã¯ç°¡åã«å¤ããããã®ã§ããªãè¯ãæãã§ãã
è¨å®ãããã¹ãã§è¨è¿°ããã ããªã®ã§ãã¤ã³ãã³ããæ¬å¼§ãã«ã³ããªã©ã®æç¡ã§è¨å®ãç¡å¹ã«ãªã£ã¦ã¤ã©ã¤ã©ããå¿ è¦ã¯ããã¾ãã*1ã
ããä¸ã¤ã®è¨å®ãè¦ã¦ã¿ã¾ããããã«ããã¨ãå·¦ããåªå
ãã¦å®ç¾©ããã¤ã¡ã¼ã¸ã¬ã¸ã¹ããªã¼ã«ç¢ºèªãã«è¡ãã¾ããDocker Hubã示ãdocker.ioã¯ä¸çªæå¾ã«è¨å®ããã¦ãã¾ããå®ç¾©ãããã¤ã¡ã¼ã¸ã¯å
ã®è¨å®ããé ã«ãæªå®ç¾©ã®ã¤ã¡ã¼ã¸ã¯æ¬¡ã®è¨å®ã«å¾ã£ã¦é ã«åç
§ãã¾ããDocker Hubã®ãã«å¶éåé¿ãããã¦ããããã§ãããããã«quay.io
ã追å ãã¦ããã¨ä¾¿å©ããããã¾ããã
$ less /etc/containers/registries.conf ... # # An array of host[:port] registries to try when pulling an unqualified image, in order. unqualified-search-registries = ["registry.fedoraproject.org", "registry.access.redhat.com", "docker.io"]
ãã®ã»ãã®è¨å®ã®ããã©ã«ãã¯/usr/share/containers
ã«ããã¾ããcontainers.conf
ãPodmanã®ä¸»ãªè¨å®ãã¾ã¨ãããã¦ãã¾ããè¨å®ãããã©ã«ãããå¤ãããå ´åã¯ãã®è¨å®ã/etc/containers/
ã«ã³ãã¼ãã¾ãã
ãã®è¨å®ã«ã¯ãªã¼ããªã³ãªã¼ãã¡ã¤ã«ã·ã¹ãã ã®è¨å®ãseccompãLinuxã±ã¼ãããªãã£ã¼ãSELinuxãä¸å¿ã¨ããã»ãã¥ãªãã£ã¼å¨ãã®è¨å®ãã©ã³ã¿ã¤ã ã®è¨å®ãªã©ãå«ã¾ãã¾ãã
ãã®è¾ºãã«ã¤ãã¦ã¯éå»ã«æ¸ããè¨äºãã覧ãã ããã
ãã£ããè¨ãã¨ãPodmanã¯ããã©ã«ãã§ãããªãå®å ¨ã«ä½¿ããããã«è¨å®ããã¦ãã¾ãã è¨å®ãå¤æ´ããã°ããã«å¼ãç· ãããã¨ãå¯è½ã§ãã
dockerã³ãã³ãã§Podmanã使ã£ã¦ã¿ã
podman-docker
ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ããå ´åã¯ãdockerã³ãã³ãã使ã£ã¦Podmanã使ãã¾ãã
試ãã«è²ã
å®è¡ãã¦ã¿ã¾ãããã
//å®è¡ããã¨ãPodmanã®ãã¼ã¸ã§ã³ã«ç½®ãæãã¦å®è¡ããã¾ã $ docker version Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. Client: Podman Engine Version: 5.1.1 API Version: 5.1.1 Go Version: go1.22.3 Built: Tue Jun 4 09:00:00 2024 OS/Arch: linux/arm64 //Podmanã®ãã«ãã表示ããã¾ã $ docker --help Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. Manage pods, containers and images Usage: podman [options] [command] ... //ã³ã³ããã®èµ·åãããã£ããdockerã³ãã³ããå®è¡ãã¦ãåä½ãã¾ã $ docker run -it --rm ubuntu Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. root@a0c267e8011d:/# root@a0c267e8011d:/# exit exit //ä¸æçãªNGINXWebãµã¼ãã¼ã®èµ·åãåé¡ãªãã§ã $ docker run --name=cont1 -d -p 8080:80 -it nginx:alpine Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. ? Please select an image: ⸠registry.fedoraproject.org/nginx:alpine registry.access.redhat.com/nginx:alpine docker.io/library/nginx:alpine ... â docker.io/library/nginx:alpine Trying to pull docker.io/library/nginx:alpine... ... //ã³ã³ããä¸è¦§ã®è¡¨ç¤ºãããæãã«ç½®ãæãã¦å®è¡ãã¦ããã¾ã $ docker ps -a Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e45594fe4f4f docker.io/library/nginx:alpine nginx -g daemon o... 10 seconds ago Up 11 seconds 0.0.0.0:8080->80/tcp, 80/tcp cont1 //ã³ã³ããã¯åé¡ãªãåãã¦ãã¾ã $ curl http://localhost:8080 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> html { color-scheme: light dark; } body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html>
Podmanã§podman-composeã使ã£ã¦ã¿ã
Podmanãã¤ã³ã¹ãã¼ã«ããç°å¢ã«podman-composeããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ããã¨ãPodmanã§docker-composeã¨åããããªã³ã³ããã¢ããªã±ã¼ã·ã§ã³ããããã¤å¯è½ã§ãã
podman-composeã¯ç¾å¨ãContainersããã¸ã§ã¯ãã®ä¸ã¤ãªãã§ããã ç¾å¨ãéçºãç¶ç¶ããã¦ãã¾ãã次ã«ããã使ã£ã¦ã¿ããã¨æãã¾ãã
- https://rheb.hatenablog.com/entry/podman3_docker_compose
- https://github.com/containers/podman-compose
- https://github.com/docker/awesome-compose
//podman-composeã¨git-coreãå ¥ãã # dnf install podman-compose git-core //ãµã³ãã«ã¢ããªããããã¤ãã¦ã¿ã # git clone https://github.com/docker/awesome-compose.git # cd awesome-compose/apache-php/ # podman-compose up -d # podman-compose ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0d879028e2a0 localhost/apache-php_web:latest apache2-foregroun... 4 seconds ago Up 4 seconds 0.0.0.0:80->80/tcp, 80/tcp apache-php_web_1
åé¡ãªããããã¤ã§ãã¾ãããã¤ã¾ããDocker Composeç¨ã«æ¸ããããããã§ã¹ãã使ã£ã¦ãï¼å 容ãå¤æ´ãããã¨ãªãï¼Podmanã¨podman-composeã§ã³ã³ããã¢ããªã±ã¼ã·ã§ã³ã®ãããã¤ãã§ããã¨ãããã¨ããããã¾ããã
å®éã«ãã©ã¦ã¶ã¼ã§ã¢ã¯ã»ã¹ãã¦ã¿ãã¨ã次ã®ããã«è¡¨ç¤ºããã¾ããé常ã«ã·ã³ãã«ã§ãã
ã¡ãªã¿ã«ãPodmanã¨Podman-composeã§Minecraft Serverãç«ã¦ã¦éã¶ãã¨ãã§ãã¾ããï¼ãã¢çã§ã¯ã§ãã¾ãããæåçã®è³¼å ¥ãå¿ è¦ã§ãï¼ã å®è¡ãã¦ã¿ãã¨ãæ¨æºçãªãã¼ã25565ã§å¾ ã¡åããã¦ãã¾ããã
# podman-compose ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1867f1612515 docker.io/itzg/minecraft-server:latest 2 hours ago Up 2 hours (healthy) 0.0.0.0:25565->25565/tcp, 25565/tcp minecraft_minecraft_1
ãããã¢ãã¬ã¹ã«å ¥åãã¦ãµã¼ãã¼ã追å ããã¨ãå¤é¨ã®Minecraft Serverã¨ãã¦ã¯ã©ã¤ã¢ã³ãããæ¥ç¶ãã¦ä½¿ããããã§ããmacOSã®Javaã¯ã©ã¤ã¢ã³ãã§ãã¼æä½ããã®ã¯ã¡ãã£ã¨æ £ããå¿ è¦ã§ãããModãå ¥ãã¦ã³ã³ããã¼ã©ã¼ã§æä½ã§ããããã«ãããã¨ããã§ããã
ä»åã¯Podmanã®ææ°çãéãã¦Podmanãæ¯ãè¿ã£ã¦ã¿ã¾ããã Podmanã¨Podman-composeã使ãã°ãããããDockerããä¹ãæããã®ã¯ç°¡åããã§ãã
*1:YAMLã¨ãjsonå½¢å¼ã®ãã¡ã¤ã«ã人åã§æ¸ãã®ã¯ã人éã«ã¯ã¾ã æ©ãã¨çè ã¯å¸¸ã æã£ã¦ãã¾ã