VOOZH about

URL: https://thenewstack.io/start-developing-with-rocky-linux-as-a-docker-container/

⇱ Start Developing with Rocky Linux as a Docker Container - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2023-11-04 06:00:40
Start Developing with Rocky Linux as a Docker Container
tutorial,
Linux

Start Developing with Rocky Linux as a Docker Container

Rocky Linux has become a popular container image. So, why not start developing with it? Here is how to get started.
Nov 4th, 2023 6:00am by Jack Wallen
👁 Featued image for: Start Developing with Rocky Linux as a Docker Container
Feature Image by Martyn Cook from Pixabay.

I tend to default to Ubuntu as my go-to OS for Docker containers. Because I’ve been using Ubuntu for such a long time, it’s just second nature to me. That doesn’t mean, however, it’s the only operating system I use.

Case in point, Rocky Linux. Whenever I need a Red Hat Enterprise Linux-based OS, I opt for the distribution created by Gregory Kurtzer who originated CentOS. Back in 2021, Kurtzer made Rocky Linux available as a container image. Since then, the Rocky Linux Docker image has enjoyed over 10 million pulls from Docker Hub.

Clearly, Rocky Linux has become a popular container image. So, why not start developing with it? One thing to know is that the Rocky Linux container image has been stripped down to only the necessary tools for container deployment. In other words, this isn’t the same Rocky Linux you can download and use as a server OS.

Let me help you get started with this task. It’s not nearly as challenging as you might think.

What You Need

The only things you’ll need for this are an operating system that supports Docker and a user with sudo privileges. I’m going to demonstrate on Ubuntu Server 22.04, so if you’re using a non-Ubuntu distribution, you’ll need to alter the Docker installation commands as shown below.

Installing Docker

On the off-chance you haven’t already installed Docker on Ubuntu Linux, here’s how it’s done.

The first thing to be done is to download and install the official Docker GPG key with the command:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Next, we must add the Docker repository so it can be installed with apt-get. The command to add the repository is:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install a few simple dependencies with the following command:

sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y

Update apt:

sudo apt-get update

Install Docker CE with the following:

sudo apt-get install docker-ce docker-ce-cli containerd.io -y

With Docker installed, you’ll need to add your user to the docker group, so you can manage Docker without having to use sudo (which can be a security issue). To add your user to the group, run the command:

sudo usermod -aG docker $USER

Finally, log out and log back in so the changes take effect.

Pulling the Rocky Linux image

Before we can deploy the container, we must pull the Rocky Linux image with the command:

docker pull rockylinux/rockylinux

When the pull completes, verify it’s available with the command:

docker images

You should see something like this in the output:

rockylinux/rockylinux   latest    523ffac7fb2e   15 months ago   196MB

Deploy and Access the Rocky Linux container

Next, we’ll deploy our container with the command:

docker run -it --name rocky -d rockylinux/rockylinux

Once the container has deployed, access it with the command:

docker exec -it --user root rocky /bin/bash

You should now find yourself at the bash prompt of the Rocky Linux container. You’ll know if the prompt starts with root@.

Install a Web Server

Let’s install the Apache web server in our running container with the command:

dnf install httpd -y

Start the Apache daemon with the command:

httpd

Verify the web server is running with the command:

curl localhost

You should see the contents of the Apache welcome page (in text form) in the output that starts with:

Exit from the running container with the command:

exit

What we’ll now do is create a new image from our running container. Instead of our image being a base Rocky Linux image, it will now include the Apache web server. Of course, before you exit the container, you could always install whatever you need that will be included in the new image.

To create the new image from the running container, you must first locate the ID of the running container with the command:

docker ps

The ID will be a random string of characters.

Next, we create our new image with the docker commit command like so:

docker commit ID rocky-httpd-template

Where ID is the first four characters of the running Rocky Linux container. Of course, you can name your template whatever you like. Just make sure the name clearly indicates what the image is to be used for.

You can then verify the new image has been successfully created with the command:

docker images

The output of the above command should look something like this:

rocky-httpd-template    latest    28dc636eb504   About a minute ago   256MB
rockylinux/rockylinux   latest    523ffac7fb2e   15 months ago        196MB

As you can see, our new template has been created and is ready to use. You could then deploy a container with that template image like so:

docker run -it --name rocky-web -d rocky-httpd-template

And that’s all there is to get started using Rocky Linux as a development image with Docker. You can now extend your efforts beyond Ubuntu Server as a base for your container deployments.

TRENDING STORIES
Jack Wallen is what happens when a Gen Xer mind-melds with present-day snark. Jack is a seeker of truth and a writer of words with a quantum mechanical pencil and a disjointed beat of sound and soul. Although he resides...
Read more from Jack Wallen
SHARE THIS STORY
TRENDING STORIES
Docker and Red Hat are sponsors of The New Stack.
TNS owner Insight Partners is an investor in: Docker.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.