Installing and Configuring Docker on CentOS build server
Problem Statement:
I need an easy way to create builds for multiple linux distribtuions.
Solution:
Create a CentOS build server with Docker. This will allow me to easily support any number of linux distributions by importing any target OS as a new image.
Step one: Installing Docker to CentOS
Note: We're doing it the more manual way.
- Find the version of CentOS you’re using by running:
cat /etc/os-release
- Navigate to https://download.docker.com/linux/centos/ and select the OS that matches the output from above. For me it was CentOS 9
- Next we need the following 5 downloads
- Install the packages that we just downloaded.
cd ~/Downloads sudo dnf install ./containerd.io-1.7.23-3.1.el9.x86_64.rpm \ ./docker-ce-27.3.1-1.el9.x86_64.rpm \ ./docker-ce-cli-27.3.1-1.el9.x86_64.rpm \ ./docker-buildx-plugin-0.17.1-1.el9.x86_64.rpm \ ./docker-compose-plugin-2.6.0-3.el9.x86_64.rpm
Step two: Configure Docker to not require sudo
- Create a docker group on CentOS build server.
sudo groupadd docker
- Add user to the newly created docker group
sudo usermod -aG docker bob-the-builder
Step three: Configure Docker to start on boot
- I honestly cant remember if docker automatically starts on boot or not, but enabling it twice can’t hurt.
sudo systemctl enable docker.service sudo systemctl enable containerd.service