<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CentOS 8 Archives - Tech Chronicles</title>
	<atom:link href="http://kostacipo.stream/tag/centos-8/feed/" rel="self" type="application/rss+xml" />
	<link>https://kostacipo.stream/tag/centos-8/</link>
	<description>Ramblings of a Tech Dude</description>
	<lastBuildDate>Mon, 29 Nov 2021 14:44:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>

<image>
	<url>https://kostacipo.stream/wp-content/uploads/2019/12/cropped-profile-32x32.jpg</url>
	<title>CentOS 8 Archives - Tech Chronicles</title>
	<link>https://kostacipo.stream/tag/centos-8/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to install Docker CE on RHEL 8 / CentOS 8</title>
		<link>http://kostacipo.stream/how-to-install-docker-ce-on-rhel-8-centos-8/</link>
					<comments>http://kostacipo.stream/how-to-install-docker-ce-on-rhel-8-centos-8/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Mon, 29 Nov 2021 14:44:25 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS 8]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[RHEL 8]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2118</guid>

					<description><![CDATA[<p>The latest release of the RHEL 8 / CentOS 8. Red Hat has built its own tools, buildah and podman, which aim to be compatible with existing docker images and work without relying on a daemon, allowing the creation of containers as normal users, without the need of special permissions (with some limitations: e.g. at [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/how-to-install-docker-ce-on-rhel-8-centos-8/">How to install Docker CE on RHEL 8 / CentOS 8</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The latest release of the RHEL 8 / CentOS 8. Red Hat has built its own tools, <code>buildah</code> and <code>podman</code>, which aim to be compatible with existing docker images and work without relying on a daemon, allowing the creation of containers as normal users, without the need of special permissions (with some limitations: e.g. at the moment of writing, it’s still not possible to map host ports to the container without privileges).</p>
<p>Some specific tools, however, are still missing: an equivalent of <code>docker-compose</code>, for example does not exists yet. In this tutorial we will see how to install and run the original Docker CE on Rhel8 by using the official Docker repository for CentOS7.</p>
<p><strong>In this tutorial you will learn:</strong></p>
<ul>
<li>How to enable the docker-ce repository on RHEL 8 / CentOS 8</li>
<li>How to install docker and docker-compose on RHEL 8 / CentOS 8</li>
</ul>
<h2>Software Requirements and Conventions Used</h2>
<table class="uk-table uk-table-striped uk-table-condensed">
<caption>Software Requirements and Linux Command Line Conventions</caption>
<thead>
<tr>
<th>Category</th>
<th>Requirements, Conventions or Software Version Used</th>
</tr>
</thead>
<tbody>
<tr>
<td class="uk-text-primary uk-text-bold">System</td>
<td>RHEL 8 / CentOS 8</td>
</tr>
<tr>
<td class="uk-text-primary uk-text-bold">Software</td>
<td>Docker version 18.09.2</td>
</tr>
<tr>
<td class="uk-text-primary uk-text-bold">Other</td>
<td>Permission to run command with root privileges.</td>
</tr>
<tr>
<td class="uk-text-primary uk-text-bold">Conventions</td>
<td><b>#</b> – requires given linux commands to be executed with root privileges either directly as a root user or by use of <code>sudo</code> command<br />
<b>$</b> – requires given linux commands to be executed as a regular non-privileged user</td>
</tr>
</tbody>
</table>
<h2>What is Docker?</h2>
<p>Docker is an open source project which allows the creation and distribution of applications inside <code>containers</code>, which are standardized environments that can be easily replicated, independently from the host system. While in Red Hat Enterprise Linux 7 Docker was officially supported, on the new release of this open source operating system, it has been replaced by a series of other tools developed by Red Hat itself: <code>buildah</code> and <code>podman</code>.</p>
<p>By the use of an external repository, however, it’s still possible to install Docker CE (Community Edition). In this tutorial we will see how to install this repository; notice however, that it was originally meant for <code>CentOS 7</code> (a RHEL clone), and the community version of Docker has no official support for Red Hat Enterprise Linux. Because of this, issues exist – we discuss them below.</p>
<h2>Adding the external repository</h2>
<p>Since Docker is not available on RHEL 8 / CentOS 8, we need to add an external repository to obtain the software. In this case we will use the official Docker CE CentOS repository: this is, at the moment of writing, the only way to install Docker CE on RHEL 8 / CentOS 8.</p>
<p>The <code>dnf config-manager</code> utility let us, among the other things, easily enable or disable a repository in our distribution. By default, only the <code>appstream</code> and <code>baseos</code> repositories are enabled on Rhel8; we need to add and enable also the <code>docker-ce</code> repo. All we need to do to accomplish this task, is to run the following command:</p>
<pre>$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo</pre>
<p>We can verify that the repository has been enabled, by looking at the output of the following command:</p>
<pre>$ sudo dnf repolist -v</pre>
<p>The command above will return detailed information about all the enabled repositories. This is what you should see at this point:</p>
<pre>Repo-id      : docker-ce-stable
Repo-name    : Docker CE Stable - x86_64
Repo-revision: 1549905809
Repo-updated : Mon 11 Feb 2019 06:23:29 PM CET
Repo-pkgs    : 30
Repo-size    : 618 M
Repo-baseurl : https://download.docker.com/linux/centos/7/x86_64/stable
Repo-expire  : 172,800 second(s) (last: Mon 18 Feb 2019 10:23:54 AM CET)
Repo-filename: /etc/yum.repos.d/docker-ce.repo

Repo-id      : rhel-8-for-x86_64-appstream-rpms
Repo-name    : Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
Repo-revision: 1542158694
Repo-updated : Wed 14 Nov 2018 02:24:54 AM CET
Repo-pkgs    : 4,594
Repo-size    : 4.9 G
Repo-baseurl : https://cdn.redhat.com/content/beta/rhel8/8/x86_64/appstream/os
Repo-expire  : 86,400 second(s) (last: Mon 18 Feb 2019 10:23:55 AM CET)
Repo-filename: /etc/yum.repos.d/redhat.repo

Repo-id      : rhel-8-for-x86_64-baseos-rpms
Repo-name    : Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)
Repo-revision: 1542158719
Repo-updated : Wed 14 Nov 2018 02:25:19 AM CET
Repo-pkgs    : 1,686
Repo-size    : 925 M
Repo-baseurl : https://cdn.redhat.com/content/beta/rhel8/8/x86_64/baseos/os
Repo-expire  : 86,400 second(s) (last: Mon 18 Feb 2019 10:23:56 AM CET)
Repo-filename: /etc/yum.repos.d/redhat.repo
Total packages: 6,310
</pre>
<h3>Installing docker-ce</h3>
<p>The <code>docker-ce-stable</code> repository is now enabled on our system. The repository contains several versions of the <code>docker-ce</code> package, to display all of them, we can run:</p>
<pre>$ dnf list docker-ce --showduplicates | sort -r
docker-ce.x86_64            3:19.03.2-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.1-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.0-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.9-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.8-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.7-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.6-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.5-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.4-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.3-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.2-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.1-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64            18.06.3.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.2.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.0.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            18.03.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.3.ce-1.el7                    docker-ce-stable
docker-ce.x86_64            17.03.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.0.ce-1.el7.centos             docker-ce-stable
</pre>
<p>What version to install? Well, Red Hat seems to have somehow blocked the installation of <code>containerd.io</code> &gt; <code>1.2.0-3.el7</code>, which is a dependency of <code>docker-ce</code>. Because of this, simply running the <code>sudo dnf install docker-ce</code> command, won’t work. As we will see in a minute, it’s still possibile to workaround this problem; once <code>docker-ce</code> is installed, however, another problem becomes evident: as long as <code>firewalld</code>, the system firewall manager is enabled, <code>DNS resolution</code> inside docker containers does not work.</p>
<p>This is, of course a critical problem. However, if you still want to proceed with the installation, here are the possible methods that can be used to avoid the dependencies issues:</p>
<ul>
<li>Install a specific version of <code>docker-ce</code> which requires an installable version of the <code>containerd.io</code> package;</li>
<li>Force the installation providing the <code>--nobest</code> option</li>
<li>Install the latest available <code>containerd.io</code> rpm manually;</li>
</ul>
<h4>Install a specific version of docker-ce</h4>
<p>To install a specific version, all we have to do is to provide the fully qualified package name, for example:</p>
<pre>$ sudo dnf install docker-ce-3:18.09.1-3.el7</pre>
<h4>Force the installation of docker-ce with the –nobest option</h4>
<p>Normally, when installing a package, the best available candidate is selected from a repository. In this case, for example, the installation of the latest version of <code>docker-ce</code> is attempted (and fails). By using the <code>--nobest</code> option, we can change this behavior so that the first version of <code>docker-ce</code> with satisfiable dependencies is selected as “fallback”, in this case <code>3:18.09.1-3.el7</code>.</p>
<pre>$ sudo dnf install --nobest docker-ce
Dependencies resolved.

Problem: package <b>docker-ce-3:19.03.2-3.el7.x86_64</b> requires containerd.io &gt;= 1.2.2-3, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.el7.x86_64 is excluded
  - package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.6-3.3.el7.x86_64 is excluded
=======================================================================================================================================================
 Package                            Arch         Version                                                  Repository                              Size
=======================================================================================================================================================
Installing:
 docker-ce                          x86_64       <b>3:18.09.1-3.el7</b>                                          docker-ce-stable                        19 M
Installing dependencies:
 containerd.io                      x86_64       1.2.0-3.el7                                              docker-ce-stable                        22 M
 docker-ce-cli                      x86_64       1:19.03.2-3.el7                                          docker-ce-stable                        39 M
 container-selinux                  noarch       2:2.94-1.git1e99f1d.module+el8.0.0+4017+bbba319f         rhel-8-for-x86_64-appstream-rpms        43 k
 tar                                x86_64       2:1.30-4.el8                                             rhel-8-for-x86_64-baseos-rpms          838 k
 libcgroup                          x86_64       0.41-19.el8                                              rhel-8-for-x86_64-baseos-rpms           70 k
 python3-policycoreutils            noarch       2.8-16.1.el8                                             rhel-8-for-x86_64-baseos-rpms          2.2 M
 python3-libsemanage                x86_64       2.8-5.el8                                                rhel-8-for-x86_64-baseos-rpms          127 k
 python3-setools                    x86_64       4.2.0-2.el8                                              rhel-8-for-x86_64-baseos-rpms          598 k
 checkpolicy                        x86_64       2.8-2.el8                                                rhel-8-for-x86_64-baseos-rpms          338 k
 python3-audit                      x86_64       3.0-0.10.20180831git0047a6c.el8                          rhel-8-for-x86_64-baseos-rpms           85 k
 policycoreutils-python-utils       noarch       2.8-16.1.el8                                             rhel-8-for-x86_64-baseos-rpms          228 k
Skipping packages with broken dependencies:
 docker-ce                          x86_64       3:19.03.2-3.el7                                          docker-ce-stable                        24 M

Transaction Summary
=======================================================================================================================================================
Install  12 Packages
Skip      1 Package

Total download size: 85 M
Installed size: 351 M
Is this ok [y/N]:</pre>
<h4>Install the latest available containerd.io package manually</h4>
<p>If we stricly need to install the latest version of <code>docker-ce</code>, we can install the required version of <code>containerd.io</code> manually, by running:</p>
<pre>$ sudo dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm</pre>
<p>After the package is installed, we can simply install the latest <code>docker-ce</code>:</p>
<pre>$ sudo dnf install docker-ce
Dependencies resolved.
=======================================================================================================================================================
  Package                          Arch                      Version                             Repository                                        Size
=======================================================================================================================================================
Installing:
  docker-ce                        x86_64                    <b>3:19.03.2-3.el7</b>                     docker-ce-stable                                  24 M
Installing dependencies:
  docker-ce-cli                    x86_64                    1:19.03.2-3.el7                     docker-ce-stable                                  39 M
  tar                              x86_64                    2:1.30-4.el8                        rhel-8-for-x86_64-baseos-rpms                    838 k
  libcgroup                        x86_64                    0.41-19.el8                         rhel-8-for-x86_64-baseos-rpms                     70 k

Transaction Summary
=======================================================================================================================================================
Install  4 Packages

Total download size: 65 M
Installed size: 275 M
Is this ok [y/N]:
</pre>
<p>This option is less convenient since the <code>containerd.io</code> package is not installed as a dependency of <code>docker-ce</code>, therefore it will not be removed automatically when the latter is uninstalled from the system.</p>
<p>Whatever method we use to install <code>docker-ce</code>, as said before, in order to make <code>DNS resolution</code> work inside Docker containers, we must disable firewalld (a system reboot may be also needed):</p>
<pre>$ sudo systemctl disable firewalld</pre>
<h2>Start and enable the docker daemon</h2>
<p>Once <code>docker-ce</code> is installed, we must start and enable the docker daemon, so that it will be also launched automatically at boot. The command we need to run is the following:</p>
<pre>$ sudo systemctl enable --now docker</pre>
<p>At this point, we can confirm that the daemon is active by running:</p>
<pre>$ systemctl is-active docker
active
</pre>
<p>Similarly, we can check that it is enabled at boot, by running:</p>
<pre>$ systemctl is-enabled docker
enabled
</pre>
<h2>Installing docker-compose</h2>
<p>Docker compose is a very useful package which let us manage multi-container applications, like for example those based on the LAMP stack, where each part of the environment (PHP, Apache, MariaDB) is provided by a dedicated container (if you are interested in the subject, take a look at our tutorial about creating a docker-based lamp stack). The package is not available on Rhel8, nor an equivalent exists to be used with the Rhel tools. It’s, however, possible to install it in many ways: just keep on reading and decide what suits you best.</p>
<h3>Global installation</h3>
<p>The way we should install <code>docker-compose</code> varies depending on whether we want to install it globally or just for a single user. At the moment of writing, the only way to install it globally is to download the binary from the github page of the project:</p>
<pre>$ curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o docker-compose</pre>
<p>Once the binary is downloaded, we move it into <code>/usr/local/bin</code> and we make it executable:</p>
<pre>$ sudo mv docker-compose /usr/local/bin &amp;&amp; sudo chmod +x /usr/local/bin/docker-compose</pre>
<p>The <code>/usr/local</code> hierarchy is not chosen randomly. This directory structure is made to be used for files installed by the local administrator manually (for software compiled from source, for example), in order to ensure separation from the software installed with the system package manager.</p>
<p>Although it’s possible for a normal user to run docker-related commands if he is part of the <code>docker</code> group (the group is automatically created when we install docker-ce), by default they must be executed with root privileges for security reasons. When we need to do the latter, since the <code>/usr/local/bin</code> directory is not in the root user’s <code>PATH</code>, we either need to call the binary specifying its location or add <code>/usr/local/bin</code> to the <code>PATH</code> itself. The first option is the one which I recommend in this case.</p>
<h3>Per-user installation</h3>
<p>If our user is part of the <code>docker</code> group, and thus it is allowed to run docker commands, and since <code>docker-compose</code> is available as a python package, we can also install it using <code>pip</code>, the python package manager. First, make sure pip itself is installed:</p>
<pre>$ sudo dnf install python3-pip</pre>
<p>To obtain docker-compose we run:</p>
<pre>$ pip3.6 install docker-compose --user</pre>
<p>Please notice that even if would be possible to run pip as root to install a package globally, this is not recommended and highly discouraged.</p>
<h2>Testing docker</h2>
<p>We installed docker and docker-compose, now to check that everything works as expected, we can try to build an image and run a container: in this case we will use the official <code>httpd</code> one. All we have to do is to launch the following command:</p>
<pre>sudo docker run --rm --name=linuxconfig-test -p 80:80 httpd</pre>
<p>Since the <code>httpd</code> image does not exists locally it will be automatically fetched and built. Finally, a container based on it will be launched in the foreground (it will be automatically removed when stopped). We should be able to see the <code>It works!</code> message when we reach our machine ip via browser.</p>
<h2>Conclusions</h2>
<p>Red Hat Enterprise Linux 8 does not support Docker: on this distribution it has been replaced by Red Hat own tools like <code>buildah</code> and <code>podman</code>, which are compatible with Docker but don’t need a server/client architecture to run. Using native tools, where possible, is always the recommended way to go, but for a reason or another you may still want to install the original Docker. In this tutorial, we saw how it is possible to install <code>Docker CE</code> on Rhel8, by using the official Docker repository for CentOS7, which is a 100% compatible clone.</p>
<p>This is not an ideal solution, and as we saw, at the moment, some workarounds are needed to make Docker work on RHEL8. If some new issues arises, or better solutions to the problems mentioned above are found, this article will be updated accordingly.</p>
<p>The post <a href="http://kostacipo.stream/how-to-install-docker-ce-on-rhel-8-centos-8/">How to install Docker CE on RHEL 8 / CentOS 8</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/how-to-install-docker-ce-on-rhel-8-centos-8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
