July 27, 2022

OpenShift 4.10 I: Custom Container Images without Dockerfile/Containerfile

$ podman run -d --name httpd-24 -p 8080:8080 registry.access.redhat.com/ubi9/httpd-24

$ podman exec httpd-24 /bin/bash -c 'echo "custom httpd image" < /var/www/html/index.html'

$ curl http://127.0.0.1:8080/ 
custom httpd image

$ podman diff httpd-24

$ podman commit --author 'Magnus K Karlsson' httpd-24 httpd-24-custom

$ podman images
REPOSITORY                                       TAG         IMAGE ID      CREATED        SIZE
localhost/httpd-24-custom                        latest      0eb89261860f  2 minutes ago  387 MB

$ podman tag localhost/httpd-24-custom quay.io/magnus_k_karlsson/httpd-24-custom:1.0

$ podman images
REPOSITORY                                       TAG         IMAGE ID      CREATED        SIZE
localhost/httpd-24-custom                        latest      0eb89261860f  5 minutes ago  387 MB
quay.io/magnus_k_karlsson/httpd-24-custom        1.0         0eb89261860f  5 minutes ago  387 MB

$ podman login quay.io
Username: magnus_k_karlsson 
Password: 
Login Succeeded!

$ podman push quay.io/magnus_k_karlsson/httpd-24-custom:1.0

$ podman pull quay.io/magnus_k_karlsson/httpd-24-custom:1.0

$ podman run -d --name httpd-24-custom -p 18080:8080 quay.io/magnus_k_karlsson/httpd-24-custom:1.0
4ca8325b0670b1b1175e8eaac442987f4cfa7f37d677eeec8dbbde9f1d0ec77e
$ curl http://127.0.0.1:18080/
custom httpd image

$ podman stop -a

$ podman rm -a

$ podman save -o httpd-24-custom.tar localhost/httpd-24-custom

$ podman rmi -a

$ podman load -i httpd-24-custom.tar

$ podman run -d --name httpd-24-custom -p 8080:8080 localhost/httpd-24-custom

$ podman logs httpd-24-custom
$ curl http://127.0.0.1:8080/
custom httpd image

No comments: