Red Hatã½ãªã¥ã¼ã·ã§ã³ã¢ã¼ããã¯ãã®å°å³¶ã§ãã
Red Hat Enterprise Linux (RHEL) 8ããã¯RHEL7ã§å°å ¥ãããDockeræè¡ãåé¤ãããPodman, Buildah, Skopeoãªã©ã®æ°ããã³ã³ããæè¡ãå°å ¥ããã¾ãããPodmanã¨Buildahã«ã¤ãã¦ã¯èµ¤å¸½ã¨ã³ã¸ãã¢ããã°ã®ä»ã®è¨äºã§æ¢ã«ç´¹ä»ããã¦ãã¾ãããããã§ã¯Podman, Buildah, UBI(RHELããã¼ã¹ã«ããç¡åæä¾ã®ã³ã³ããã¤ã¡ã¼ã¸)ã®å ·ä½çãªå©ç¨æé ããã¹ã©ã¤ã(P.7~)ã«ã¾ã¨ãã¦ãã¾ããã¾ããRed Hat Developer Programã«åå ãã¦éçºè åãã®ç¡åãµãã¹ã¯ãªãã·ã§ã³ãå ¥æãããã¨ã§ããããã®æé ãç¡æã§è©¦ãã¦ã¿ããã¨ãã§ãã¾ããRed Hat Developer Programã«ã¤ãã¦ã¯ä¸è¨ã®è¨äºãåèã«ãã¦ãã ããã
âå©ç¨æé ä¾(ã³ããç¨)
Podmanã®ã¤ã³ã¹ãã¼ã«
$ sudo subscription-manager register $ sudo subscription-manager attach --auto $ sudo yum -y install podman $ sudo yum -y install podman-docker <- podman-dockerã¯ãdockerã¨ããååã§podmanã³ãã³ãã¸ã®ã·ã³ããªãã¯ãªã³ã¯ãä½æããããã®ããã±ã¼ã¸(ãªãã·ã§ã³)
Podmanã®å©ç¨ä¾
$ podman pull registry.access.redhat.com/ubi8/ubi:latest $ podman run --name test01 -it registry.access.redhat.com/ubi8/ubi:latest /bin/bash [root@c21ad143c67f /]# yum -y install httpd [root@c21ad143c67f /]# exit $ podman ps -a CONTAINER ID IMAGE COMMAND CREATED NAMES aeb95fb38a18 registry.access.redhat.com/ubi8/ubi:latest /bin/bash 38 seconds ago test01 $ podman start -ai test01 [root@aeb95fb38a18 /]# exit $ podman commit test01 httpd_ubi_01 $ podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/httpd_ubi_01 latest d610cfd1a46f About a minute ago 242 MB registry.access.redhat.com/ubi8/ubi latest ecbc6f53bba0 2 weeks ago 211 MB
UBIã¨Dockerfileãå©ç¨ããã³ã³ããã¤ã¡ã¼ã¸ã®ä½æä¾
$ cat << EOF > myecho > echo "This container works!!" > EOF $ cat << EOF > Dockerfile > FROM registry.access.redhat.com/ubi8/ubi > ADD myecho /usr/local/bin > ENTRYPOINT "/usr/local/bin/myecho" > EOF $ chmod +x myecho $ ./myecho This container works!! $ ls Dockerfile myecho $ podman build . STEP 1: FROM registry.access.redhat.com/ubi8/ubi ... Storing signatures STEP 2: ADD myecho /usr/local/bin 9f842e451aeb46b0852a33362f0632d182008631e30ead39fa03bbd5ac8eb18f STEP 3: ENTRYPOINT "/usr/local/bin/myecho" STEP 4: COMMIT 0db4e77ef97e260c24129434881a51d06dcb32f5f38aaecf193aca62aa60c890 $ podman images REPOSITORY TAG IMAGE ID CREATED SIZE <none> <none> 0db4e77ef97e 2 minutes ago 211 MB registry.access.redhat.com/ubi8/ubi latest ecbc6f53bba0 2 weeks ago 211 MB
Red Hat Quay.io(ç¡æãã¤ç¡å¶éã«å©ç¨å¯è½ãªãããªãã¯ã¬ã¸ã¹ããªã®SaaSãæä¾)ã¸ã®ã¤ã¡ã¼ã¸ã®pushä¾
$ podman login quay.io Username: <your_user_name> Password: <your_password> Login Succeeded! $ podman images $ podman tag <ä½æããã¤ã¡ã¼ã¸ã®Container ID> quay.io/<your_user_name>/myecho $ podman push quay.io/<your_user_name>/myecho
Buildahã®ã¤ã³ã¹ãã¼ã«ã¨å©ç¨ä¾
$ sudo yum -y install buildah $ buildah from scratch <- ãworking-containerãã¨ããååã®scratchã³ã³ãããä½æ working-container $ buildah unshare <- ç¹æ¨©ã¦ã¼ã¶ã®æ¨©éãå©ç¨ãã¦ãã³ã³ããã®rootãã¡ã¤ã«ã·ã¹ãã ãã¦ã¼ã¶ã®ãã¼ã ãã£ã¬ã¯ããªã®ä¸ã«ãã¦ã³ãã§ããããã«ãªãã¾ã # scratchmnt=$(buildah mount working-container) <- scratchã³ã³ããã®rootãã¡ã¤ã«ã·ã¹ãã ããã¦ã³ã # yum install -y --releasever=8 --installroot=$scratchmnt redhat-release <- scratchã³ã³ããã§ã®RPMãã¼ã¿ãã¼ã¹ã®åæåã¨redhat-releaseããã±ã¼ã¸ã®è¿½å # yum install -y --setopt=reposdir=/etc/yum.repos.d \ --installroot=$scratchmnt \ --setopt=cachedir=/tmp/cache/dnf bash <- scratchã³ã³ããã¸ã®bashã®ã¤ã³ã¹ãã¼ã« # echo "echo Your container from scratch worked." > $scratchmnt/usr/local/bin/myecho <- scratchã³ã³ããã«myechoãã¡ã¤ã«ã®è¿½å # chmod +x $scratchmnt/usr/local/bin/myecho # buildah config --entrypoint "/usr/local/bin/myecho" working-container <- ã³ã³ããèµ·åæã«myechoãã¡ã¤ã«ãå®è¡ãããã¨ãæå® # buildah commit working-container localhost/myecho:latest <- scratchã³ã³ããã®å¤æ´ãã³ããããã¦ãlocalhost/myechoãã¤ã¡ã¼ã¸ãä½æ # exit $ podman run localhost/myecho <- buildahã§ä½æããã¤ã¡ã¼ã¸ãpodmanã§èµ·å Your container from scratch worked.