50

Is it possible to install DockerCE in the specific version 17.03 on RHEL7 ?

user3313834
  • 7,327
  • 12
  • 56
  • 99
  • 1
    You might have to [handle the dependency on `container-selinux`](https://stackoverflow.com/questions/45272827/docker-ce-on-rhel-requires-container-selinux-2-9) – Raedwald Sep 25 '18 at 10:15

8 Answers8

81

As per the documentation here, you can install Docker CE 17.03 (or future versions) on RHEL 7.3 64-bit via:

Set up the Docker CE repository on RHEL:

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast

Install the latest version of Docker CE on RHEL:

sudo yum -y install docker-ce

Alternatively, you can specify a specific version of Docker CE:

sudo yum -y install docker-ce-<version>-<release>

Start Docker:

sudo systemctl start docker

Test your Docker CE installation:

sudo docker run hello-world
Matthew Schuchard
  • 25,172
  • 3
  • 47
  • 67
  • 1
    Are there any licensing concerns with attempting to manually install Docker CE on RHEL? Is this legally allowed? – link_boy Aug 03 '17 at 16:45
  • 4
    This is not actually a manual install, but besides the point, non-enterprise Moby is released under the Apache 2.0 license, so there are no licensing issues with installing and using it. If you took code from enterprise and reused it, or used enterprise without paying for it, then there would probably be licensing issues. – Matthew Schuchard Aug 03 '17 at 16:53
  • 5
    Don't forget `sudo systemctl enable docker`, otherwise the service won't start automatically on boot. – fnkr Nov 02 '17 at 15:34
  • 3
    My machine has the RPM `docker-1.12.6-16-e17.x86_64` installed, and I got error of `Error: docker-ce conflicts with 2:docker-1.12.6-16.el7.x86_64`. There are two suggestions after the error message: 1. `You could try using --skip-broken to work around the problem` and 2. `You could try running: rpm -Va --nofiles --nodigest`. What would you recommend? Thanks! – leeyuiwah Nov 24 '17 at 20:19
  • 5
    @leeyuiwah You have to uninstall the old Docker RPM first. For some reason, Docker (company) forgot to use the `obsoletes` tag in its RPM metadata so CE does not automatically replace the older series like it should. – Matthew Schuchard Jan 18 '18 at 12:23
  • when i ran `sudo systemctl enable docker` it is giving me `Failed to start docker.service: Unit not found.` Has anyone got this? – Gangadhar Jannu Mar 14 '18 at 09:18
  • Make sure you've configured proxy in `yum` before doing `sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo ` – Gangadhar Jannu Apr 09 '18 at 08:18
  • note that someone will need `sudo yum update -y` before installing docker – Ivan Aracki May 22 '18 at 12:48
34

Procedure for a disposable dev test RHEL 7.3. Never do this in production.

# pre-requisite for container-selinux-2.9-4.el7.noarch.rpm
sudo yum install policycoreutils-python

wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.107-3.el7.noarch.rpm
sudo rpm -i container-selinux-2.21-1.el7.noarch.rpm

#Set up the Docker CE repository on RHEL:
sudo yum install -y yum-utils
sudo yum install -y device-mapper-persistent-data lvm2
sudo yum-config-manager --enable rhel-7-server-extras-rpms
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast

# Install the latest version of Docker CE on RHEL:
sudo yum -y install docker-ce

#Start Docker:
sudo systemctl start docker

#Test your Docker CE installation:
sudo docker run hello-world

# configure Docker to start on boot
sudo systemctl enable docker

# add user to the docker group 
sudo usermod -aG docker jethro

# install Docker Compose:
# install python-pip
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

sudo yum install ./epel-release-latest-7.noarch.rpm
sudo yum install -y python-pip

sudo pip install docker-compose

# upgrade your Python packages:
sudo yum upgrade python*

The above assumes you are NOT using a proxy. If you are, you will need to add proxy=http://myproxy:myport lines pretty much at the end of each block in each file under /etc/yum.repos.d/, or add it to /etc/yum.conf.

Hope this helps.

robert
  • 4,612
  • 2
  • 29
  • 39
Bertrand_Szoghy
  • 880
  • 1
  • 11
  • 26
  • your solution perfectly worked! Thanks a lot! Question: why you are not recommending same process for PRD? then what will be right process for PRD? – Tushar De Jul 14 '17 at 21:34
  • 1
    You will want and need Docker support in production in particular for scalability issues. – Bertrand_Szoghy Jul 17 '17 at 21:28
  • The container-selinux part is outdated. Use: `wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.21-1.el7.noarch.rpm; rpm -i container-selinux-2.21-1.el7.noarch.rpm` – MadMike Jan 05 '18 at 13:44
  • This is close, but the official AMI for RHEL 7 on AWS ships with xfs filesystem with d_type=0, and won't start for me. https://community.centminmod.com/threads/using-docker-on-centos-7-choose-ext4-over-xfs.12492/ – Mike Atlas Jan 31 '18 at 23:20
  • Latest verion `sudo yum install policycoreutils-python` `wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.74-1.el7.noarch.rpm; rpm -i container-selinux-2.74-1.el7.noarch.rpm` – Sheng Mar 13 '19 at 02:29
  • After spending all morning trying to get docker set up on a redhat7 machine with centos repo (due to rhel licencing restrictions), this has got me up and running. No idea what just happened, would be great if the magic here could be explained! – robert Oct 29 '19 at 11:41
19

For those who are facing below error:

Error: Package: docker-ce-17.06.0.ce-1.el7.centos.x86_64 (docker-ce-stable)
       Requires: container-selinux >= 2.9
       You could try using --skip-broken to work around the problem
       You could try running: rpm -Va --nofiles --nodigest

While installing docker on RHEL 7.3+ we need to execute:

    sudo subscription-manager repos --enable rhel-7-server-extras-rpms

which will enable extra rpms to be installed on yum update.After this execute:

    sudo yum update

Then follow: Install Docker

This has worked for me.

Raedwald
  • 46,613
  • 43
  • 151
  • 237
  • 6
    Seems as of Docker 18.03+ it needs the additional dependency `pigz`- which is sadly not in _Extras_; but in EPEL -> `yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm`:( – Christian Ulbrich Apr 13 '18 at 15:26
  • Executing the `subsciption-manager` command, I get a connection refused error: "Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information." – dokaspar May 29 '18 at 13:07
9

INSTALLING DOCKER RHEL/CENTOS

  1. Got To: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

    download: docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm 2018-06-08 05:48 19M download: docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm 2018-06-08 05:48 29K

    Upload to server

    1. yum -y install docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm

    2. yum -y install docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm

    3. sudo systemctl start docker

    4. REF: install Docker CE 17.03 on RHEL7 https://nickjanetakis.com/blog/docker-tip-39-installing-docker-ce-on-redhat-rhel-7x https://docs.docker.com/install/linux/docker-ee/rhel/#set-up-the-repository

Fred Ondieki
  • 2,314
  • 25
  • 23
2

Well maybe you can acheive installing Docker CE 17.06 or 17.03 on RHEL 7.3, but Docker documentation is quite clear:

Docker Community Edition (Docker CE) is not supported on RHEL.

See https://docs.docker.com/engine/installation/linux/docker-ee/rhel/

2

I had the same problem running 7.x and I did the following:

yum install -y yum-utils

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -ivh epel-release-latest-7.noarch.rpm

subscription-manager repos --enable=rhel-7-server-extras-rpms

yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.55-1.el7.noarch.rpm

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

yum install -y docker-ce

systemctl restart docker

With this you'll not fall on the pigz error

Error: Package: docker-ce-18.03.1.ce-1.el7.centos.x86_64 (docker-ce-stable)
           Requires: pigz
 You could try using --skip-broken to work around the problem

Also you need to keep an eye on the container-selinux since i'm using a direct link to the version 2.55-1

PekosoG
  • 246
  • 3
  • 9
0

By following From @Matt Schuchard and @Akash Srivastava

combining their commands together I found below command lines working for me.

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast
sudo subscription-manager repos --enable rhel-7-server-extras-rpms
sudo yum update
sudo yum -y install docker-ce
sudo systemctl start docker

Thank you

0

We had offline environment, so I figure out to install all required packages one by one.

  • Run online.sh script to download these packages.
  • Copy these packages to your server scp -r *.rpm my.server:/tmp
  • Go to your server , cd /tmp, then run offline.sh script.
Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254