Author: Marty Ballard
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=https://download.docker.com/linux/centos/docker-ce.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] Environment="HTTPS_PROXY=http://<proxy-url>:<proxy-port>" Environment="HTTP_PROXY=http://<proxy-url>:<proxy-port>"` - 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 "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(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.