How to Install Docker CE on RHEL 8 Behind Corporate Firewall

Author: Marty Ballard


Category: Docker

So I've been assigned a task at my current client, they want me to build out a CI/CD pipeline using some new on prem servers they have purchased.  The good thing is they are Linux, but the not so good thing is they are RedHat.  RedHat isn't bad by any means, but I'm much more familar with Debian.  So it's been a bit of a learning curve.

Today I'm going to document how to setup Docker CE on a RHEL 8 server behind a corporate firewall and using a proxy.  The corporate firewall can really throw a wrench in setting up anything, fortunately they also have a proxy.  The way I'm setting this up reqires root, so if you don't have root you may need to adjust the commands below.  I've made this pretty easy if you just follow along it can be done in a few minutes.

Install Docker
- Add proxy to /etc/dnf/dnf.conf - `proxy=http://<proxy-url>:<proxy-port>`
- Enable Docker CE Repository - `dnf config-manager --add-repo=`
- Verify Repository availability and install - `dnf list docker-ce`
- Install Docker CD using dnf Command - `dnf install docker-ce --nobest -y`
- Start Docker - `systemctl start docker`
- Enable Docker - `systemctl enable docker`
- Validatate Docker is running - `docker --version`

Set Docker Proxy
- Create drop-in - `mkdir /etc/systemd/system/docker.service.d`
- Create http-proxy.conf `touch /etc/systemd/system/docker.service.d/http-proxy.conf`
- Populate Proxy data - `[Service]
- Reload systemd daemon - `systemctl daemon-reload`
- Restart docker - `systemctl restart docker`
- Verify config has been loaded `systemctl show docker --property Environment`
- Test Docker - `docker run hello-world`

At this piont you should have docker running on the server!  🎉  There is one more thing that I needed to do as I use docker-compose and this was not available.  Follow the remaining steps to install docker-compose and then you can really use docker.

Install Docker-Compose
curl -x http://<proxy-url>:<proxy-port> -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

And with that docker-compose is setup.

You should now have docker and docker-compose fully setup and ready to go.

Make sure to follow LearningToFly for more tips and tricks.


Header image - Photo by Julius Silver from Pexels

There are 2 comments below.

Post your comment

July 9, 2021, 7:10 p.m. - Marty Ballard moderator  
@Viktoriloc Just click your user name in the nav bar and then click on Change Password. It's very simple.
July 6, 2021, 6:33 p.m. - Marty Ballard moderator  
@Viktoriloc you have to have a relationship to the site to create a post.