{"id":126655,"date":"2022-07-18T08:00:00","date_gmt":"2022-07-18T08:00:00","guid":{"rendered":"https:\/\/fedoramagazine.org\/?p=36812"},"modified":"2022-07-18T08:00:00","modified_gmt":"2022-07-18T08:00:00","slug":"community-container-images-available-for-applications-development","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2022\/07\/18\/community-container-images-available-for-applications-development\/","title":{"rendered":"Community container images available for applications development"},"content":{"rendered":"<p>This article aims to introduce community containers, where users can pull them from, and use them. <mark>The three groups of containers av<\/mark>ailable for use <mark>by community users a<\/mark>re <mark>discussed.<\/mark> These are: Fedora, CentOS, and CentOS Stream.<\/p>\n<p> <span id=\"more-36812\"><\/span> <\/p>\n<h2>What are the differences between the containers?<\/h2>\n<p>Fedora containers are based on the latest stable Fedora content, and CentOS-7 containers are based on components from the CentOS-7 and related SCLo SIG components. And finally, CentOS Stream containers are based on either CentOS Stream 8 or CentOS Stream 9.<\/p>\n<p>Each container, e.g. <a href=\"https:\/\/github.com\/sclorg\/s2i-php-container\" target=\"_blank\" rel=\"noreferrer noopener\">s2i-php-container<\/a> or <a href=\"https:\/\/github.com\/sclorg\/s2i-perl-container\" target=\"_blank\" rel=\"noreferrer noopener\">s2i-perl-container<\/a>, contain the same packages which are available for a given operating system. It means, that from a functionality point of view these example containers provides the PHP interpreter or Perl interpreter,respectively.&nbsp;<\/p>\n<p>Differences can be only in versions, which are available for each distribution. For example:<\/p>\n<p>Fedora PHP containers are available in these versions:<\/p>\n<ul>\n<li><a href=\"https:\/\/quay.io\/repository\/fedora\/php-80\" target=\"_blank\" rel=\"noreferrer noopener\">PHP-80<\/a> for Fedora 35<\/li>\n<\/ul>\n<p>CentOS-7 PHP containers are available in these versions:<\/p>\n<ul>\n<li><a href=\"https:\/\/quay.io\/repository\/centos7\/php-73-centos7\" target=\"_blank\" rel=\"noreferrer noopener\">PHP-73<\/a><\/li>\n<\/ul>\n<p>CentOS Stream 9 PHP containers are available in these versions:<\/p>\n<ul>\n<li><a href=\"https:\/\/quay.io\/repository\/sclorg\/php-74-c9s\" target=\"_blank\" rel=\"noreferrer noopener\">PHP-74<\/a><\/li>\n<\/ul>\n<p>CentOS Stream 8 is not mentioned here for the PHP use case since users can pull it directly from the Red Hat Container Catalog registry as a <a href=\"https:\/\/www.redhat.com\/en\/blog\/introducing-red-hat-universal-base-image\" target=\"_blank\" rel=\"noreferrer noopener\">UBI<\/a> image. Containers that are not UBI based have CentOS Stream 8 repositories in the <a href=\"https:\/\/quay.io\/organization\/sclorg\" target=\"_blank\" rel=\"noreferrer noopener\">quay.io\/sclorg<\/a> namespace with repository suffix &#8220;-c8s&#8221;.<\/p>\n<h2>Fedora container images moved recently<\/h2>\n<p>The Fedora container images have recently moved to the <a href=\"https:\/\/quay.io\/organization\/fedora\" target=\"_blank\" rel=\"noreferrer noopener\">quay.io\/fedora<\/a> registry organization. All of them use <a href=\"http:\/\/quay.io\/fedora\/fedora:35\" target=\"_blank\" rel=\"noreferrer noopener\">Fedora:35<\/a>, and later <a href=\"http:\/\/quay.io\/fedora\/fedora:36\" target=\"_blank\" rel=\"noreferrer noopener\">Fedora:36 ,<\/a>as a base image. The CentOS-7 containers are stored in the <a href=\"https:\/\/quay.io\/organization\/centos7\">quay.<\/a><a href=\"https:\/\/quay.io\/organization\/centos7\" target=\"_blank\" rel=\"noreferrer noopener\">io<\/a><a href=\"https:\/\/quay.io\/organization\/centos7\">\/centos7<\/a> registry organization. All of them use <a href=\"http:\/\/quay.io\/centos\/centos:centos7\" target=\"_blank\" rel=\"noreferrer noopener\">CentOS<\/a><a href=\"http:\/\/quay.io\/centos\/centos:centos7\">-7<\/a> as a base image.<\/p>\n<h2>CentOS Stream container images<\/h2>\n<p>The CentOS Stream containers are stored in the <a href=\"https:\/\/quay.io\/organization\/sclorg\" target=\"_blank\" rel=\"noreferrer noopener\">quay.io\/sclorg<\/a> registry organization.<\/p>\n<p>The base image used for our CentOS Stream 8 containers is <a href=\"https:\/\/quay.io\/repository\/centos\/centos\" target=\"_blank\" rel=\"noreferrer noopener\">CentOS Stream 8<\/a> with the tag &#8220;stream8&#8221;.<\/p>\n<p>The base image used for our CentOS Stream 9 containers is <a href=\"https:\/\/quay.io\/repository\/centos\/centos\" target=\"_blank\" rel=\"noreferrer noopener\">CentOS Stream 9<\/a> with the tag &#8220;stream9&#8221;.<\/p>\n<p>In this registry organization, each container contains a &#8220;suffix&#8221;, either &#8220;c8s&#8221;\u00a0 for CentOS Stream 8 or &#8220;c9s&#8221; for CentOS Stream 9, respectively.<\/p>\n<p>See container <a href=\"https:\/\/quay.io\/repository\/sclorg\/php-74-c9s\" target=\"_blank\" rel=\"noreferrer noopener\">PHP-74<\/a> for CentOS Stream 9.<\/p>\n<h2>Frequency of container image updates and testing<\/h2>\n<p>The community-based containers are updated in two ways. <\/p>\n<p>First, when a pull request in the container sources that live under github.com\/sclorg organization is merged, the corresponding versions in the GitHub repository are built and pushed into the proper repository.<\/p>\n<p>Second, an update process is also implemented by GitHub Actions set up in each of our GitHub repositories. The base images, like &#8220;s2i-core&#8221; and &#8220;s2i-base&#8221;, are built each Tuesday at 1:00 pm. The rest of the containers are built each Wednesday at 1:00 pm.<\/p>\n<p>This means every package update or change is updated in the container image within a few days, not later than after a week.<\/p>\n<p>Each container that is not beyond its end of life is tested by our nightly builds. If we discover or detect an error on some of our containers, we attempt to fix it, but there are no guarantees provided.<\/p>\n<h2>What container shall I use?<\/h2>\n<p>In the end, what containers are we providing? That\u2019s a great question. All containers live in the GitHub organization <a href=\"https:\/\/github.com\/sclorg\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg<\/a><\/p>\n<p>The list of containers with their upstreams is summarized here:<\/p>\n<ul>\n<li>PostgreSQL server &#8211; <a href=\"https:\/\/github.com\/sclorg\/postgresql-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/postgresql-container<\/a><\/li>\n<li>Nginx web server &#8211; <a href=\"https:\/\/github.com\/sclorg\/nginx-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/nginx-container<\/a><\/li>\n<li>Redis server &#8211; <a href=\"https:\/\/github.com\/sclorg\/redis-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/redis-container<\/a><\/li>\n<li>Varnish cache &#8211; <a href=\"https:\/\/github.com\/sclorg\/varnish-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/varnish-container<\/a><\/li>\n<li>MySQL server &#8211; <a href=\"https:\/\/github.com\/sclorg\/mysql-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/mysql-container<\/a><\/li>\n<li>MariaDB server &#8211; <a href=\"https:\/\/github.com\/sclorg\/mariadb-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/mariadb-container<\/a><\/li>\n<li>Apache HTTPD server &#8211; <a href=\"https:\/\/github.com\/sclorg\/httpd-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/httpd-container<\/a><\/li>\n<li>PHP application container image &#8211; <a href=\"https:\/\/github.com\/sclorg\/s2i-php-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/s2i-php-container<\/a><\/li>\n<li>Perl application container image &#8211; <a href=\"https:\/\/github.com\/sclorg\/s2i-perl-container\">https:\/\/<\/a><a href=\"https:\/\/github.com\/sclorg\/s2i-perl-container\" target=\"_blank\" rel=\"noreferrer noopener\">github<\/a><a href=\"https:\/\/github.com\/sclorg\/s2i-perl-container\">.com\/sclorg\/s2i-perl-container<\/a><\/li>\n<li>Ruby application container image &#8211; <a href=\"https:\/\/github.com\/sclorg\/s2i-ruby-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/s2i-ruby-container<\/a><\/li>\n<li>Node.js application container image &#8211; <a href=\"https:\/\/github.com\/sclorg\/s2i-nodejs-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/s2i-nodejs-container<\/a><\/li>\n<li>Python application container image &#8211; <a href=\"https:\/\/github.com\/sclorg\/s2i-python-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/s2i-python-container<\/a><\/li>\n<\/ul>\n<h2>How to use the container image I picked?<\/h2>\n<p>All container images are tuned up to be fully functional in the OpenShift (or <a href=\"https:\/\/developers.redhat.com\/blog\/2018\/08\/03\/okd-renaming-of-openshift-origin-with-3-10-release#\" target=\"_blank\" rel=\"noreferrer noopener\">OKD<\/a> and even Kubernetes itself) without any trouble. Some containers support the source-to-image build strategy while some are expected to be used as daemons (like databases, for instance). For specific steps, please, navigate to the GitHub page for the respective container image by following one of the links above.<\/p>\n<h2>Finally, Some Real examples<\/h2>\n<p>Let\u2019s show how to use PHP container images across all platforms that we support.<\/p>\n<p>First of all, clone the container GitHub repository using this command:<\/p>\n<pre class=\"wp-block-preformatted\">$ git clone <a href=\"https:\/\/github.com\/sclorg\/s2i-php-container\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/sclorg\/s2i-php-container<\/a><\/pre>\n<p>Switch to the following directory created by the cloning step:<\/p>\n<pre class=\"wp-block-preformatted\">$ cd s2i-php-container\/examples\/from-dockerfile<\/pre>\n<h3>Fedora example<\/h3>\n<p>Start by pulling the Fedora PHP-80 image with this command:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman pull quay.io\/fedora\/php-80<\/pre>\n<p>Modify &#8220;Dockerfile&#8221; so it refers to Fedora php-80 image. &#8220;Dockerfile&#8221; then looks like:<\/p>\n<pre class=\"wp-block-preformatted\">FROM quay.io\/fedora\/php-80 USER 0\n# Add application sources\nADD app-src .\nRUN chown -R 1001:0 .\nUSER 1001 # Install the dependencies\nRUN TEMPFILE=$(mktemp) &amp;&amp; \\ curl -o \"$TEMPFILE\" \"https:\/\/getcomposer.org\/installer\" &amp;&amp; \\ php &lt;\"$TEMPFILE\" &amp;&amp; \\ .\/composer.phar install --no-interaction --no-ansi --optimize-autoloader # Run script uses standard ways to configure the PHP application\n# and execs httpd -D FOREGROUND at the end\n# See more in &lt;version&gt;\/s2i\/bin\/run in this repository.\n# Shortly what the run script does: The httpd daemon and php need to be\n# configured, so this script prepares the configuration based on the container\n# parameters (e.g. available memory) and puts the configuration files into\n# the appropriate places.\n# This can obviously be done differently, and in that case, the final CMD\n# should be set to \"CMD httpd -D FOREGROUND\" instead.\nCMD \/usr\/libexec\/s2i\/run<\/pre>\n<h4>Check if the application works properly<\/h4>\n<p>Build it by using this command:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman build -f Dockerfile -t cakephp-app-80<\/pre>\n<p>Now run the application using this command:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman run -ti --rm -p 8080:8080 cakephp-app-80<\/pre>\n<p>To check the PHP version use these commands:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman run -it \u2013rm cakephp-app-80 bash\n$ php \u2013version<\/pre>\n<p>To check if everything works properly use this command:<\/p>\n<pre class=\"wp-block-preformatted\">$ curl -s -w \u2018%{http_code}\u2019 localhost:8080<\/pre>\n<p>This should return HTTP code 200. If you would like to see a web page enter &#8220;localhost:8080&#8221; in your browser.<\/p>\n<h3>CentOS 7 example<\/h3>\n<p>Start by pulling the CentOS-7 PHP-73 image using this command:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman pull quay.io\/centos7\/php-73-centos7<\/pre>\n<p>Modify &#8220;Dockerfile&#8221; so it refers to CentOS php-73 image.<\/p>\n<p>&#8220;Dockerfile&#8221; then looks like this:<\/p>\n<pre class=\"wp-block-preformatted\">FROM quay.io\/centos7\/php-73-centos7 USER 0\n# Add application sources\nADD app-src .\nRUN chown -R 1001:0 .\nUSER 1001 # Install the dependencies\nRUN TEMPFILE=$(mktemp) &amp;&amp; \\ curl -o \"$TEMPFILE\" \"https:\/\/getcomposer.org\/installer\" &amp;&amp; \\ php &lt;\"$TEMPFILE\" &amp;&amp; \\ .\/composer.phar install --no-interaction --no-ansi --optimize-autoloader # Run script uses standard ways to configure the PHP application\n# and execs httpd -D FOREGROUND at the end\n# See more in &lt;version&gt;\/s2i\/bin\/run in this repository.\n# Shortly what the run script does: The httpd daemon and php needs to be\n# configured, so this script prepares the configuration based on the container\n# parameters (e.g. available memory) and puts the configuration files into\n# the appropriate places.\n# This can obviously be done differently, and in that case, the final CMD\n# should be set to \"CMD httpd -D FOREGROUND\" instead.\nCMD \/usr\/libexec\/s2i\/run<\/pre>\n<h4>Check if the application works properly<\/h4>\n<p>Build it using this command:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman build -f Dockerfile -t cakephp-app-73<\/pre>\n<p>Now run the application using this command:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman run -ti --rm -p 8080:8080 cakephp-app-73<\/pre>\n<p>To check the PHP version us these commands:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman run -it \u2013rm cakephp-app-73 bash\n$ php \u2013version<\/pre>\n<p>To check if everything works properly use this command:<\/p>\n<pre class=\"wp-block-preformatted\">curl -s -w \u2018%{http_code}\u2019 localhost:8080<\/pre>\n<div class=\"wp-container-1 wp-block-group\">\n<div class=\"wp-block-group__inner-container\">\n<p>which should return HTTP code 200. If you would like to see a web page enter localhost:8080 in your browser.<\/p>\n<\/div>\n<\/div>\n<h3>RHEL 9 UBI 9 real example<\/h3>\n<p>Start by pulling the RHEL9 UBI-based PHP-80 image using the command:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman pull registry.access.redhat.com\/ubi9\/php-80<\/pre>\n<p>Modify &#8220;Dockerfile&#8221; so it refers to the RHEL9 ubi9 php-80 image.<\/p>\n<p>&#8220;Dockerfile&#8221; then looks like:<\/p>\n<pre class=\"wp-block-preformatted\">FROM registry.access.redhat.com\/ubi9\/php-80 USER 0\n# Add application sources\nADD app-src .\nRUN chown -R 1001:0 .\nUSER 1001 # Install the dependencies\nRUN TEMPFILE=$(mktemp) &amp;&amp; \\ curl -o \"$TEMPFILE\" \"https:\/\/getcomposer.org\/installer\" &amp;&amp; \\ php &lt;\"$TEMPFILE\" &amp;&amp; \\ .\/composer.phar install --no-interaction --no-ansi --optimize-autoloader # Run script uses standard ways to configure the PHP application\n# and execs httpd -D FOREGROUND at the end\n# See more in &lt;version&gt;\/s2i\/bin\/run in this repository.\n# Shortly what the run script does: The httpd daemon and php needs to be\n# configured, so this script prepares the configuration based on the container\n# parameters (e.g. available memory) and puts the configuration files into\n# the appropriate places.\n# This can obviously be done differently, and in that case, the final CMD\n# should be set to \"CMD httpd -D FOREGROUND\" instead.\nCMD \/usr\/libexec\/s2i\/run<\/pre>\n<h4>Check if the application works properly<\/h4>\n<p>Build it using this command:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman build -f Dockerfile -t cakephp-app-80-ubi9<\/pre>\n<p>Now run the application using this command:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman run -ti --rm -p 8080:8080 cakephp-app-80-ubi9<\/pre>\n<p>To check the PHP version use these commands:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman run -it \u2013rm cakephp-app-80-ubi9 bash\n$ php \u2013version<\/pre>\n<p>To check if everything works properly use this command:<\/p>\n<pre class=\"wp-block-preformatted\">curl -s -w \u2018%{http_code}\u2019 localhost:8080<\/pre>\n<p>which should return HTTP code 200. If you would like to see a web page enter localhost:8080 in your browser.<\/p>\n<h2>What to do in the case of a bug or enhancement<\/h2>\n<p>Just file a bug (known as an &#8220;issue&#8221; in GitHub) or even a pull request with a fix, to one of the GitHub repositories mentioned in the previous section.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article aims to introduce community containers, where users can pull them from, and use them. The three groups of containers available for use by community users are discussed. These are: Fedora, CentOS, and CentOS Stream. What are the differences between the containers? Fedora containers are based on the latest stable Fedora content, and CentOS-7 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[45,61,46,47],"class_list":["post-126655","post","type-post","status-publish","format-standard","hentry","category-fedora-os","tag-fedora","tag-fedora-project-community","tag-magazine","tag-news"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/126655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=126655"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/126655\/revisions"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=126655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=126655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=126655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}