çãã¾ãããã«ã¡ã¯ãRed Hatã®è¥¿æ(@iamnishipy)ã§ããå ¥ç¤¾ããã¾ã§Dockerã¦ã¼ã¶ã¼ã ã£ãç§ããããããããã¨æããPodmanã®è¨äºãå ±æãããã¾ãã
ãã®è¨äºã¯Red Hat Developerã®Podman and Buildah for Docker usersãã許å¯ãåãã¦ç¿»è¨³ãããã®ã§ãã
:::William Henry 2019å¹´2æ21æ¥:::
æè¿Twitterã«ã¦ãDockerã«è©³ãã人ã®ããã«Podmanã¨Buildahããããã説æãã¦ã»ããã¨é ¼ã¾ãã¾ãããããã°ããã¥ã¼ããªã¢ã«(å¾ã»ã©ç´¹ä»)ã¯ããããããã¾ãããDockerã¦ã¼ã¶ã¼ãã©ã®ããã«DockerããPodmanãBuildahã«ç§»è¡ãã¦ããã®ãã«ã¤ãã¦ãç§ãã¡ã³ãã¥ããã£ããä¸å çãªèª¬æãè¡ã£ã¦ãã¾ããã§ãããBuildahã¯ã©ã®ãããªå½¹å²ãæããã¦ããã®ã§ããããï¼Dockerãç½®ãæããããã«ãPodmanã¨Buildahã®ä¸¡æ¹ãå¿ è¦ãªã»ã©ãPodmanã«ã¯ä½ããã®æ¬ é¥ãããã®ã§ããããï¼
ãã®è¨äºã§ã¯ãããã®çåã«çããPodmanã¸ã®ç§»è¡æ¹æ³ãç´¹ä»ãã¾ãã
Dockerã¯ã©ã®ããã«åãã®ãï¼
PodmanãBuildahãç解ããããã«ãã¾ãDockerãã©ã®ããã«åä½ããã®ããæ確ã«ãã¦ããã¾ããããDockerã¦ã¼ã¶ã¼ã§ããã°ããã¹ã¦ã®Dockerã³ãã³ããå¦çããããã«ããã¼ã¢ã³ããã»ã¹ãå®è¡ããªããã°ãªããªããã¨ãç解ãã¦ããã¨æãã¾ãããã®èæ¯ã«ããåæ©ãç解ãããã¨ã¯ã§ãã¾ããããå½æã¯Dockerãè¡ããã¨ãã¹ã¦ãä¸ç®æã§å®æ½ããããã«å°æ¥ã®é²åã®ããã«ãã®ããã»ã¹ã«æç¨ãªAPIãæä¾ããã®ããç´ æ´ãããã¢ã¤ãã¢ã«æããã®ã§ã¯ãªããã¨æ³åãã¦ãã¾ããä¸ã®å³ãè¦ãã¨ãDockerãã¼ã¢ã³ãå¿ è¦ãªãã¹ã¦ã®æ©è½ãæä¾ãã¦ãããã¨ããããã¾ãã
- ã¤ã¡ã¼ã¸ã¬ã¸ã¹ããªããã¤ã¡ã¼ã¸ããã«ããã³ããã·ã¥ãã
- ãã¼ã«ã«ã³ã³ããã¹ãã¬ã¼ã¸ã«ã¤ã¡ã¼ã¸ã®ã³ãã¼ãä½æãããããã®ã³ã³ããã«ã¬ã¤ã¤ã¼ã追å ãã
- ã³ã³ãããã³ããããããã¹ããªãã¸ããªãããã¼ã«ã«ã³ã³ããã¤ã¡ã¼ã¸ãåé¤ãã
- ã«ã¼ãã«ã«å¯¾ãã¦ãæ£ããåå空éãcgroupãªã©ãæå®ãã¦ã³ã³ãããå®è¡ããããã«ä¾é ¼ãã
åºæ¬çã«ã¯ãDockerãã¼ã¢ã³ãã¬ã¸ã¹ããªãã¤ã¡ã¼ã¸ãã³ã³ãããã«ã¼ãã«ãå©ç¨ãããã¹ã¦ã®ä½æ¥ãå®æ½ãã¾ããDockerã³ãã³ãã©ã¤ã³ã¤ã³ã¿ã¼ãã§ã¤ã¹(CLI)ã¯ãããªãã®ä»£ããã«ãããè¡ããããã¼ã¢ã³ã«ä¾é ¼ãã¾ãã
ãã®è¨äºã§ã¯ãDockerãã¼ã¢ã³ããã»ã¹ã®è©³ç´°ãªé·æã¨çæã«ã¤ãã¦ã¯æ±ãã¾ããããã®ã¢ããã¼ãã«è³æãããã¨ã¯å¤ãããã¾ãããDockerã®åæã®é ããã®ã¢ããã¼ããå¤ãã®æå³ãæã£ã¦ããçç±ããããã¾ãããããDockerã®å©ç¨ãå¢ããã«ã¤ããDockerã¦ã¼ã¶ã¼ããã®ã¢ããã¼ããä¸å®è¦ããçç±ãããã¤ããã£ããã¨ã¯ãè¨ãã¾ã§ãããã¾ããã以ä¸ã«ãããã¤ãæãã¦ããã¾ãã
- 1ã¤ã®ããã»ã¹ã1ã¤ã®é害ç¹ã«ãªãå¯è½æ§ããã
- ãã®ããã»ã¹ã¯ãã¹ã¦ã®åããã»ã¹(å®è¡ä¸ã®ã³ã³ãã)ãææãã
- é害ãçºçããå ´åãå¤å (orphan)ã¨ãªãããã»ã¹ãåå¨ãã
- ãã¹ã¦ã®Dockerã®æä½ã¯ãåä¸ã®å®å ¨ãªroot権éãæã¤ã¦ã¼ã¶ã¼ã«ãã£ã¦è¡ãããªããã°ãªããªãã£ã
ãã®ä»ã«ãããã§ãããããããã®åé¡ãä¿®æ£ããããã©ããããã®ç¹å¾´ä»ãã«åæã§ããªãã®ãã©ããã¯ããã®è¨äºã§ã¯è°è«ã®å¯¾è±¡ã§ã¯ããã¾ãããç§ãã¡ã³ãã¥ããã£ã¯ãPodmanããããã®åé¡ã®å¤ãã解決ããã¨ä¿¡ãã¦ãã¾ããPodmanã®æ¹åç¹ãæ´»ç¨ãããã®ã§ããã°ããã®è¨äºãå½¹ç«ã¡ã¾ãã
Podmanã®ã¢ããã¼ãã¯ãåç´ã«ã¤ã¡ã¼ã¸ã¬ã¸ã¹ããªãã³ã³ããã¨ã¤ã¡ã¼ã¸ã¹ãã¬ã¼ã¸ãããã¦runCã³ã³ããã©ã³ã¿ã¤ã ããã»ã¹(ãã¼ã¢ã³ã§ã¯ããã¾ãã)ãä»ãã¦Linuxã«ã¼ãã«ã¨ç´æ¥å¯¾è©±ãããã¨ã§ãã
åæ©ã®ä¸é¨ã説æããã¨ããã§ãPodmanã«ç§»è¡ããã¦ã¼ã¶ã¼ã«ã¨ã£ã¦ãããä½ãæå³ããã®ããè°è«ãã¾ãããã ããã§åãããããã¨ã¯ããã¤ããããããããã«åå¥ã«èª¬æãã¾ãã
- Dockerã®ä»£ããã«Podmanãã¤ã³ã¹ãã¼ã«ãã
- Dockerã§ã馴æã¿ã®ã³ãã³ãã¯Podmanã§ãåãããã«åä½ãã
- Podmanã¯ã³ã³ããã¨ã¤ã¡ã¼ã¸ãDockerã¨ã¯å¥ã®å ´æã«ä¿åãã
- Podmanã¨Dockerã¤ã¡ã¼ã¸ã¯äºææ§ããã
- Podmanã¯Kubernetesç°å¢ã®ããã«Dockerãããå¤ãã®ãã¨è¡ã
- Buildahã¨ã¯ä½ãããªãå¿ è¦ãªã®ãï¼
Podmanã®ã¤ã³ã¹ãã¼ã«
ç¾å¨Dockerã使ã£ã¦ããã®ã§ããã°ã移è¡ãããã¨æ±ºããæç¹ã§Dockerãåé¤ã§ãã¾ããããããPodmanã試ãã¦ããéã¯Dockerã使ãç¶ãããããããã¾ããã便å©ãªãã¥ã¼ããªã¢ã«ã¨ç´ æ´ããããã¢ãããã®ã§ã移è¡ãããç解ããããã«æåã«å®è¡ãã¦ã¿ãã¨ããã§ãããããã¢ã®ä¾ã§ã¯ãäºææ§ã示ãããã«Dockerãå¿ è¦ã¨ãã¦ãã¾ãã
Red Hat Enterprise Linux 7.6以éã«Podmanãã¤ã³ã¹ãã¼ã«ããã«ã¯ã以ä¸ã®ããã«ãã¾ããFedoraã使ç¨ãã¦ããå ´åã¯ãyum
ãdnf
ã«ç½®ãæãã¦ãã ããã
# yum -y install podman
Podmanã³ãã³ãã¯Dockerã³ãã³ãã¨åã
Podmanãæ§ç¯ããéã®ç®æ¨ã¯ãDockerã¦ã¼ã¶ã¼ãç°¡åã«é©å¿ã§ããããã«ãããã¨ã§ããããã®ãããããªãã¿ã®ã³ãã³ãã¯ãã¹ã¦Podmanã«ãåå¨ãã¦ãã¾ããå®éãDockerãå®è¡ããæ¢åã®ã¹ã¯ãªãããæã£ã¦ããã°ãpodman
ç¨ã®docker
ã¨ã¤ãªã¢ã¹(alias docker=podman
)ãä½æããã°ããã¹ã¦ã®ã¹ã¯ãªãããåä½ããã¯ãã§ãããã¡ãããæåã«Dockerãåæ¢(systemctl stop docker
)ãã¦ããå¿
è¦ãããã¾ããpodman-dockerã¨ããããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ããã°ããã®å¤æãè¡ã£ã¦ããã¾ãã/usr/bin/docker
ã®ã¹ã¯ãªãããããããããåãå¼æ°ã§Podmanãå®è¡ãã¾ãã
ããªããããç¥ã£ã¦ããã³ãã³ããä¾ãã°pull
ãpush
ãbuild
ãrun
ãcommit
ãtag
ãªã©ã¯ãã¹ã¦Podmanã«å«ã¾ãã¦ãã¾ãã詳細ã«ã¤ãã¦ã¯ãPodmanã®ããã¥ã¢ã«ãã¼ã¸ãåç
§ãã¦ãã ãããç¹çãã¹ãéãã¯ãPodmanãä¸é¨ã®ã³ãã³ãã«ããã¤ãã®ä¾¿å©ãªãã©ã°ã追å ãããã¨ã§ããä¾ãã°ãPodmanã§ã¯ãpodman rm
ã¨podman rmi
ã«--all
(-a
)ãã©ã°ã追å ããã¦ãã¾ãã便å©ã ã¨æããã¦ã¼ã¶ã¼ãå¤ãã¯ãã§ãã
ã¾ããFedoraä¸ã®Podman 1.0ã§ã¯ãé常ã®érootã¦ã¼ã¶ã¼ãããPodmanãå®è¡ãããã¨ãã§ãã¾ããRHELã®ãµãã¼ãã¯ãã¼ã¸ã§ã³7.7ã¨8.1以éã対象ã¨ãã¦ãã¾ããã¦ã¼ã¶ã¼ã¹ãã¼ã¹ã®ã»ãã¥ãªãã£ãå¼·åããããã¨ã§ããããå¯è½ã«ãªãã¾ãããé常ã®ã¦ã¼ã¶ã¼ã¨ãã¦Podmanãå®è¡ããã¨ãããã©ã«ãã§ã¯Podmanã¯ã¤ã¡ã¼ã¸ã¨ã³ã³ãããã¦ã¼ã¶ã¼ã®ãã¼ã ãã£ã¬ã¯ããªã«ä¿åãã¾ããããã«ã¤ãã¦ã¯æ¬¡ã®ã»ã¯ã·ã§ã³ã§èª¬æãã¾ããPodmanãérootã¦ã¼ã¶ã¼ã¨ãã¦å®è¡ããæ¹æ³ã®è©³ç´°ã«ã¤ãã¦ã¯ãDan Walshããã®How does rootless Podman work?1ãã覧ãã ããã
Pormanã¨ã³ã³ããã¤ã¡ã¼ã¸
æåã«podman images
ã¨å
¥åããã¨ããã§ã«ãã«ããã¦ããDockerã¤ã¡ã¼ã¸ã表示ããã¦ããªããã¨ã«é©ãããããã¾ãããããã¯ãPodmanã®ãã¼ã«ã«ãªãã¸ããªã/var/lib/docker
ã§ã¯ãªã/var/lib/containers
ã«ããããã§ããæ£æçãªå¤æ´ã§ã¯ãªãããã®æ°ããã¹ãã¬ã¼ã¸æ§é ã¯Open Containers Initiative(OCI)ã«æºæ ãã¦ãã¾ãã
2015å¹´ãDockerãRed HatãCoreOSãSUSEãGoogleãªã©ã®Linuxã³ã³ããæ¥çã®ãªã¼ãã¼ãã¡ã¯ãã³ã³ããã¤ã¡ã¼ã¸ã¨ã©ã³ã¿ã¤ã ãå®ç¾©ããããã®æ¨æºä»æ§ã管çããç¬ç«ããçµç¹ãã¨ãã¦ãOpen Container Initiativeãè¨ç«ãã¾ããããã®ç¬ç«æ§ãç¶æããããã«ãcontainers/imageããã¸ã§ã¯ãã¨containers/storageããã¸ã§ã¯ããGitHubä¸ã«ä½ããã¾ããã
rootã§ãªãã¦ãpodman
ãå®è¡ã§ãããããpodman
ãã¤ã¡ã¼ã¸ãæ¸ãè¾¼ããå¥ã®å ´æãå¿
è¦ã§ããPodmanã¯ã¦ã¼ã¶ã¼ã®ãã¼ã ãã£ã¬ã¯ããªã«ãããªãã¸ããªãå©ç¨ãã¾ããPodmanã¯ã¦ã¼ã¶ã¼ã®ãã¼ã ãã£ã¬ã¯ããªã«ãããªãã¸ããªãã¤ã¾ã~/.local/share/containers
ãå©ç¨ãã¾ããããã«ããã/var/lib/containers
ã誰ã§ãæ¸ãè¾¼ã¿å¯è½ã«ãªããã¨ããæ½å¨çãªã»ãã¥ãªãã£åé¡ã«ã¤ãªããå¯è½æ§ã®ãããã®ä»ã®æ¹æ³ãåé¿ã§ãã¾ããã¾ããããã«ããããã¹ã¦ã®ã¦ã¼ã¶ã¼ãå¥ã
ã®ã³ã³ããã¨ã¤ã¡ã¼ã¸ã®ã»ãããæã¡ããã¹ã¦ã®ã¦ã¼ã¶ã¼ãåããã¹ãä¸ã§ããäºãã«å¹²æ¸ããã«åæã«Podmanã使ç¨ã§ããããã«ãªãã¾ããã¦ã¼ã¶ã¼ã¯ä½æ¥ãçµãã£ãããå
±éã®ã¬ã¸ã¹ããªã«ããã·ã¥ãã¦ã¤ã¡ã¼ã¸ãä»ã®äººã¨å
±æãããã¨ãã§ãã¾ãã
Podmanã使ãããã«ãªã£ãDockerã¦ã¼ã¶ã¼ã¯ããããã®å ´æãç¥ã£ã¦ããã¨ããããã°ãããç´ãããã¨ãã«éè¦ãªrm -rf /var/lib/containers
ãè¡ãéã«ã便å©ã ã¨æ°ä»ãã¾ããããããPodmanã使ãå§ããã¨ãããããpodman rm
ã¨podman rmi
ã«å¯¾ãã¦æ°ãã--all
ãªãã·ã§ã³ã代ããã«ä½¿ãã§ãããã
ã³ã³ããã¤ã¡ã¼ã¸ã¯Podmanã¨ä»ã®ã©ã³ã¿ã¤ã ã®éã§äºææ§ããã
ãã¼ã«ã«ãªãã¸ããªã®å ´æãæ°ãããªã£ãã«ãé¢ããããDockerãPodmanã§ä½æãããã¤ã¡ã¼ã¸ã¯OCIæ¨æºã¨äºææ§ãããã¾ããPodmanã¯ãã©ã¤ãã¼ãã¬ã¸ã¹ããªã ãã§ãªããQuay.ioãDocker hubã®ãããªä¸è¬çãªã³ã³ããã¬ã¸ã¹ããªã¸ã®ããã·ã¥ããã«ãå¯è½ã§ããä¾ãã°ãDocker hubããææ°ã®Fedoraã¤ã¡ã¼ã¸ããã«ãã¦ãPodmanã使ã£ã¦å®è¡ãããã¨ãã§ãã¾ããã¬ã¸ã¹ããªãæå®ããªãã¨ãPodmanã¯ããã©ã«ãã§registries.conf
ãã¡ã¤ã«ã«ãªã¹ãããã¦ããã¬ã¸ã¹ããªãé çªã«æ¤ç´¢ãããã¨ã«ãªãã¾ããregistries.conf
ãã¡ã¤ã«ãå¤æ´ããã¦ããªãå ´åã¯ãæåã«Docker hubãæ¤ç´¢ãã¾ãã
$ podman pull fedora:latest $ podman run -it fedora bash
Dockerã§ã¤ã¡ã¼ã¸ã¬ã¸ã¹ããªã«ããã·ã¥ããã¤ã¡ã¼ã¸ã¯ãPodmanã§ãã«ãã¦å®è¡ãããã¨ãã§ãã¾ãã以ä¸ã®ä¾ã®ããã«ãDockerã使ã£ã¦ä½æããã¤ã¡ã¼ã¸(myfedora)ãDockerã使ã£ã¦Quay.ioã®ãªãã¸ããª(ipbabble)ã«ããã·ã¥ãããã®ã¯ã以ä¸ã®ããã«Podmanã§ãã«ãã¦å®è¡ãããã¨ãã§ãã¾ãã
$ podman pull quay.io/ipbabble/myfedora:latest $ podman run -it myfedora bash
Podmanã®ã³ãã³ãã©ã¤ã³ã§ã¯ãpush
ã³ãã³ãã¨pull
ã³ãã³ãã§ãã¤ã¡ã¼ã¸ã/var/lib/docker
ãã/var/lib/containers
ã«ãã¾ãã¯ãã®éã«é©åã«ç§»åãããæ©è½ãæä¾ãã¾ãã ä¾ãã°ã次ã®ããã«ã§ãã¾ãã
$ podman push myfedora docker-daemon:myfedora:latest
ä¸è¨ã®docker-daemon
ãé¤å¤ããã¨ãããã©ã«ãã§Docker hubã«ããã·ã¥ããã¾ããquay.io/myquayid/myfedora
ã使ãã¨ãã¤ã¡ã¼ã¸ãQuay.ioã¬ã¸ã¹ããªã«ããã·ã¥ãã¾ããä½ããmyquayid
ã¯ãå人ã®Quay.ioã¢ã«ã¦ã³ãã§ãã
$ podman push myfedora quay.io/myquayid/myfedora:latest
Dockerãåé¤ããæºåãã§ãããããã¼ã¢ã³ãã·ã£ãããã¦ã³ãã¦ããããã±ã¼ã¸ããã¼ã¸ã£ã使ã£ã¦Dockerããã±ã¼ã¸ãåé¤ãã¦ãã ãããä½ããDockerã§ä½æããã¤ã¡ã¼ã¸ãä¿æãã¦ããããå ´åã¯ããããã®ã¤ã¡ã¼ã¸ãã¬ã¸ã¹ããªã«ããã·ã¥ããã¦ãããã¨ã確èªãã¦ãå¾ã§ãããããã«ã§ããããã«ãã¦ããå¿ è¦ãããã¾ãããããã¯ãPodmanã使ã£ã¦ããã¹ãã®Dockerãªãã¸ããªããPodmanã®OCIãã¼ã¹ã®ãªãã¸ããªã«åã¤ã¡ã¼ã¸ï¼ä¾ãã°feedoraï¼ãå¼ã£å¼µã£ã¦ãããã¨ãã§ãã¾ããRHELã§ã¯ä»¥ä¸ã®ããã«å®è¡ã§ãã¾ããRHELã§ã¯ä»¥ä¸ã®ããã«å®è¡ã§ãã¾ãã
# systemctl stop docker # podman pull docker-daemon:fedora:latest # yum -y remove docker # optional
Podmanã¯ãKubernetesã¸ã®ç§»è¡ãæ¯æ´ãã
Podmanã¯ãKubernetesç°å¢ã§ã®éçºè ãéç¨è ãæ¯æ´ããããã¤ãã®è¿½å æ©è½ãæä¾ãã¦ãã¾ããããã«ã¯ãDockerã§ã¯å©ç¨ã§ããªããã®ãå«ã¾ãã¾ããDockerã«æ £ã親ããã§ãã¦ãã³ã³ãããã©ãããã©ã¼ã ã¨ãã¦Kubernetes/OpenShiftã®ä½¿ç¨ãæ¤è¨ãã¦ããå ´åãPodmanãå½¹ç«ã¡ã¾ãã
Podmanã¯ãpodman generate kube
ã使ç¨ãã¦å®è¡ä¸ã®ã³ã³ããã«åºã¥ãã¦Kubernetesã®YAMLãã¡ã¤ã«ãçæã§ãã¾ããpodman pod
ã¨ããã³ãã³ãã¯ãæ¨æºã®ã³ã³ããã³ãã³ãã¨ã¨ãã«ãå®è¡ä¸ã®Kubernetesãããã®ãããã°ãæ¯æ´ããã®ã«å½¹ç«ã¡ã¾ããPodmanãã©ã®ããã«Kubernetesã¸ã®ç§»è¡ãæ¯æ´ãããã®è©³ç´°ã«ã¤ãã¦ã¯ãBrent Baudeããã®Podman can now ease the transition to Kubernetes and CRI-Oãåç
§ãã ããã
Buildahã¨ã¯ä½ãï¼ãªã使ãã®ãï¼
å®ã¯Buildahãå ã«åºã¦ãã¾ãããä¸é¨ã®Dockerã¦ã¼ã¶ã¼ã¯å°ãæ··ä¹±ãã¦ãã¾ãã®ã¯ããã®ããããç¥ãã¾ãããããªããã®Podmanã¨ãã³ã¸ã§ãªã¹ããã¡ãBuildahã®è©±ããã¦ãããã ããï¼Podmanã¯ãã«ããããªãã®ãï¼ã
Podmanã¯ãã«ããè¡ãã¾ãããDockerã«è©³ãã人ã«ã¨ã£ã¦ã¯ãã«ãã®ããã»ã¹ã¯åãã§ããpodman build
ãå®è¡ãã¦Dockerfileã使ã£ã¦ãã«ãããããã³ã³ãããå®è¡ãã¦å¤ãã®å¤æ´ãå ãããã®å¤æ´ãæ°ããã¤ã¡ã¼ã¸ã¿ã°ã«ã³ããããããã®ã©ã¡ããã§ããBuildahã¯ã³ã³ããã¤ã¡ã¼ã¸ã®ä½æã¨ç®¡çã«é¢é£ããã³ãã³ãã®ã¹ã¼ãã¼ã»ããã¨è¡¨ç¾ãããã¨ãã§ããã¤ã¡ã¼ã¸ã«å¯¾ãã¦ããç´°ããå¶å¾¡ãè¡ããã¨ãã§ãã¾ããPodmanã®build
ã³ãã³ãã«ã¯Buildahã®æ©è½ã®ãµãã»ãããå«ã¾ãã¦ãã¾ãããã«ãã«ã¯Buildahã¨åãã³ã¼ãã使ç¨ãã¾ãã
Buildahã使ãæãå¼·åãªæ¹æ³ã¯ãDockerfileãæ¸ãã®ã¨åãããã«ã¤ã¡ã¼ã¸ãä½æããããã®Bashã¹ã¯ãªãããæ¸ããã¨ã§ãã
次ã®ããã«é²åããã¨èããã¨ããã§ããKubernetesãOCIã©ã³ã¿ã¤ã ä»æ§ã«åºã¥ããCRI-Oã«ç§»è¡ããã¨ãã«ãDockerãã¼ã¢ã³ãå®è¡ããå¿
è¦ãããã¾ããããã®ãããKubernetesã¯ã©ã¹ã¿å
ã®ã©ã®ãã¹ãã«ã¤ãã¦ããããããã³ã³ãããåããããã«Dockerãã¤ã³ã¹ãã¼ã«ããå¿
è¦ãããã¾ããã§ãããKubernetesã¯CRI-Oãå¼ã³åºããã¨ãã§ããrunCãç´æ¥å¼ã³åºããã¨ãã§ãã¾ãããããã«ãããã³ã³ããããã»ã¹ãèµ·åãã¾ããããããOpenShiftã¯ã©ã¹ã¿ã使ãå ´åãªã©ã§ãåãKubernetesã¯ã©ã¹ã¿ã使ã£ã¦ãã«ããè¡ãéã«ãDockerãã¼ã¢ã³ãå¿
è¦ã¨ããããã®å¾ã«Dockerã®ã¤ã³ã¹ãã¼ã«ãå¿
è¦ã¨ããªããã«ãç¨ã®æ°ãããã¼ã«ãæ±ãããã¾ããããã®ãããªãã¼ã«ã¯ãcontainers/storage
ããã¸ã§ã¯ãã¨containers/image
ããã¸ã§ã¯ãããã¼ã¹ã«ãã¦ãããå¤ãã®ã¦ã¼ã¶ã¼ãæ¸å¿µãã¦ãããã«ãæã®ãªã¼ãã³ãªDockerãã¼ã¢ã³ã½ã±ããã®ã»ãã¥ãªãã£ãªã¹ã¯ãæé¤ãããã¨ãã§ãã¾ãã
Buildah(ãbuilderããçºé³ããã¨ãã®Dan Walshããã®ãã¹ãã³ã¢ã¯ã»ã³ããé¢ç½ãããããçç±ã§åä»ãããã)ã¯ããã®è¦æã«åè´ãã¾ãããBuildahã®è©³ç´°ã«ã¤ãã¦ã¯buildah.ioãåç §ããç¹ã«ããã°ããã¥ã¼ããªã¢ã«ã®ã»ã¯ã·ã§ã³ãã覧ãã ããã
å®åè ãBuildahã«ã¤ãã¦ç解ãã¦ããã¹ããã¨ã¯ãããã¤ãããã¾ãã
- ã¤ã¡ã¼ã¸ã¬ã¤ã¤ã¼ã®ä½æãããç´°ããå¶å¾¡ã§ããããã«ãªãã¾ããããã¯å¤ãã®ã³ã³ããã¦ã¼ã¶ã¼ãé·ãéæ±ãã¦ããæ©è½ã§ãã1ã¤ã®ã¬ã¤ã¤ã¼ã«å¤ãã®å¤æ´ãã³ããããããã¨ãæã¾ããã§ãã
- Buildahã®
run
ã³ãã³ãã¯ãPodmanã®run
ã³ãã³ãã¨ã¯ç°ãªãã¾ããBuildahã¯ã¤ã¡ã¼ã¸ããã«ãããããã®ãã®ãªã®ã§ãrun
ã³ãã³ãã¯åºæ¬çã«Dockerfileã®RUN
ã³ãã³ãã¨åãã§ããå®éãç§ã¯ãããæ示ãããã¨ãã®ãã¨ãè¦ãã¦ãã¾ãã試ãã¦ãããã¼ãããã¦ã³ããæã£ãããã«åããªãã¨æç´ã£ã¦ãã¾ãããDanãã(@rhatdan)ã¯ãBuildahã¯ãã®ãããªæ¹æ³ã§ã®ã³ã³ããå®è¡ããµãã¼ããã¹ãã§ã¯ãªãã¨æè¦ãè¿°ã¹ã¾ããããã¼ããããã³ã°ãããªãããããªã¥ã¼ã ãã¦ã³ããããã¾ããããããã®ãã©ã°ã¯åé¤ããã¾ããã 代ããã«buildah run
ã¯ã³ã³ããã¤ã¡ã¼ã¸ã®æ§ç¯ãæ¯æ´ããããã«ç¹å®ã®ã³ãã³ããå®è¡ããããã®ãã®ã§ãä¾ãã°buildah run dnf -y install nginx
ã®ããã«ãªãã¾ãã - buildah ã¯ã¼ãããã¤ã¡ã¼ã¸ãæ§ç¯ãããã¨ãã§ãã¾ããã¼ãããã§ããå®éã
buildah from scratch
ã³ãã³ãã®çµæã¨ãã¦ä½æãããã³ã³ããã¹ãã¬ã¼ã¸ãè¦ãã¨ã空ã®ãã£ã¬ã¯ããªã表示ããã¾ããããã¯ãã¢ããªã±ã¼ã·ã§ã³ãå®è¡ããããã«å¿ è¦ãªããã±ã¼ã¸ã ããå«ããé常ã«è»½éãªã¤ã¡ã¼ã¸ãä½æããã®ã«ä¾¿å©ã§ãã
ã¹ã¯ã©ãããã«ãã®è¯ã使ç¨ä¾ã¯ãJavaã¢ããªã±ã¼ã·ã§ã³ã®éçºç¨ã¤ã¡ã¼ã¸ã¨ã¹ãã¼ã¸ã³ã°ç¨ã¤ã¡ã¼ã¸ãã¾ãã¯æ¬çªç¨ã¤ã¡ã¼ã¸ãæ¯è¼ãããã¨ã§ããéçºä¸ã®Javaã¢ããªã±ã¼ã·ã§ã³ã³ã³ããã¤ã¡ã¼ã¸ã¯ãJavaã³ã³ãã¤ã©ãMavenãªã©ã®ãã¼ã«ãå¿ è¦ã¨ãããã¨ãããã¾ããããããæ¬çªç°å¢ã§ã¯ãJavaã©ã³ã¿ã¤ã ã¨ããã±ã¼ã¸ã ãã§ããããããã¾ãããã¡ãªã¿ã«ãDNF/YUMãBashãªã©ã®ããã±ã¼ã¸ããã¼ã¸ã£ãå¿ è¦ããã¾ãããBuildahã¯ãã®ã¦ã¼ã¹ã±ã¼ã¹ã®ããã®å¼·åãªCLIã§ããä¸ã®å³ãåç §ãã¦ãã ããã詳ããã¯ãBuilding a Buildah Container Image for Kubernetesãããã¡ãã®Buildahã®ãã¢ãåç §ãã¦ãã ããã
é²åã®è©±ã«æ»ãã¾ããCRI-Oã¨runCã§Kubernetesã®ã©ã³ã¿ã¤ã åé¡ã解決ããBuildahã§ãã«ãåé¡ã解決ããä»ã§ããKubernetesãã¹ãä¸ã§Dockerãã¾ã å¿ è¦ã¨ããã¦ããçç±ã1ã¤ããã¾ããããããã°ã§ãããããã°ããããã®ãã¼ã«ããªãå ´åãã©ããã£ã¦ãã¹ãä¸ã§ã³ã³ããã®åé¡ã確èªã§ããã§ããããï¼Dockerãã¤ã³ã¹ãã¼ã«ããå¿ è¦ãããã°ããã¹ãä¸ã§Dockerãã¼ã¢ã³ã使ç¨ãã¦ããæã®ãããªç¶æ ã«æ»ã£ã¦ãã¾ãã¾ããããããPodmanã¯ãã®åé¡ã解決ãã¾ãã
Podmanã¯2ã¤ã®åé¡ã解決ãããã¼ã«ã«ãªãã¾ããéç¨è ã使ãæ £ããã³ãã³ãã§ãã³ã³ãããã¤ã¡ã¼ã¸ã調ã¹ããã¨ãå¯è½ã«ãã¾ããããã¦ãéçºè ã«ãåããã¼ã«ãæä¾ãã¾ããã¤ã¾ããDockerã¦ã¼ã¶ã¼ã§ãéçºè ã§ãéç¨è ã§ããPodmanã«ç§»è¡ãã¦ãDockerã§æ £ã親ããã 楽ããã¿ã¹ã¯ããã¹ã¦è¡ããã¨ãã§ããããã«å¤ãã®ãã¨ãã§ããããã«ãªãã¾ãã
çµè«
ãã®è¨äºãå½¹ã«ç«ã¡ãèªä¿¡ãæã£ã¦ç¡äºã«Podman(ããã³ Buildah)ã¸ç§»è¡ã§ãããã¨ãé¡ãã¾ãã
ãã詳細ãªæ å ±ã¯ã以ä¸ãã覧ãã ããã
- Podman.ioããã¸ã§ã¯ãã¨Buildah.ioããã¸ã§ã¯ãã®Webãµã¤ã
- github.com/containersããã¸ã§ã¯ã: åå ããããã½ã¼ã¹ãå ¥æããããéçºä¸ã®ãã®ãè¦ããã§ãã¾ã
é¢é£è¨äº
- Containers without daemons: Podman and Buildah available in RHEL 7.6 and RHEL 8 Beta
- Podman: Managing pods and containers in a local container runtime
- Managing containerized system services with Podman: systemdã使ã£ã¦ãPodmanã®ã³ã³ããã管çãã
- Building a Buildah Container Image for Kubernetes
- Podman can now ease the transition to Kubernetes and CRI-O
- Security Considerations for Container Runtimes: Dan Walshããã®KubeCon 2018ã§ã®è¬æ¼æ å
- IoT edge development and deployment with containers through OpenShift: Part 1: podmanãqemuãbinfmt_miscãAnsibleã使ã£ã¦OpenShiftä¸ã§ARM64ã³ã³ãããæ§ç¯ããã¹ããã
-
æ¥æ¬èªçã®è¨äºãã«ã¼ãã¬ã¹ã®Podmanã¯ã©ã®ããã«åä½ãã¾ããï¼ããããã¾ã↩