Docker is a powerful platform that allows you to develop, deploy, and run applications within containers, providing a consistent and efficient environment. If you’re using CentOS Stream 9, here’s a step-by-step guide to help you install Docker and get started with containerization.

Prerequisites

Before you start, ensure you have:

  • A CentOS Stream 9 system.
  • Administrative access to the system.

Step 1: Update Your System

Always begin by updating your system to the latest packages and security patches:

sudo dnf update

Step 2: Install the Required Dependencies

Docker requires some dependencies to be installed on your system. To do this, run the following command:

sudo dnf install dnf-plugins-core

Step 3: Add Docker Repository

CentOS Stream 9 does not have Docker in its default repository, so you’ll need to add the Docker repository. Use the following command:

sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Step 4: Install Docker

With the repository added, you can now install Docker using the following command:

sudo dnf install docker-ce

Step 5: Start and Enable Docker

To start Docker and enable it to run at system startup, use the following commands:

sudo systemctl start docker
sudo systemctl enable docker

Step 6: Verify Docker Installation

You can confirm that Docker is installed and running by checking its version:

docker --version

Step 7: Test Docker with a Hello World Container

To verify that Docker is working correctly, run a simple “Hello World” container:

docker run hello-world

If you see a message indicating that your installation appears to be working correctly, Docker is up and running.

FAQ

What is Docker used for?

Docker is used to containerize applications, making it easier to package, distribute, and run software across different environments consistently.

Can I run Docker containers as a non-root user?

Yes, you can run Docker containers as a non-root user by adding your user to the docker group. Use the command: sudo usermod -aG docker your_username. Remember to log out and log back in for the changes to take effect.

Are there any alternatives to Docker on CentOS Stream 9?

Yes, alternatives like Podman and containerd are also popular containerization solutions on CentOS Stream 9.

With Docker successfully installed on your CentOS Stream 9 system, you’re ready to leverage the benefits of containerization, simplifying application deployment and management while ensuring system reliability and consistency.

Share.

I am a Full-Stack Web Developer & Security Analyst from Bangladesh. I have built web/online applications on various Open Source Stacks and love information security testing.

Leave A Reply

Exit mobile version