
Docker is an open-source platform that enables the creation, packaging, distribution, and deployment of applications using lightweight, portable containers. Each container includes all the necessary runtime dependencies, libraries, application code, and configuration parameters required to run software reliably across multiple environments and on any host system. On Rocky Linux 9, Docker offers a consistent and efficient way to manage containerized applications, making it easier to develop, test, and deploy software in isolated environments.
This article explains how to install Docker on Rocky Linux 9 and run containerized applications on your server. You'll set up the Docker Engine, which allows you to create and manage lightweight, portable containers. For those using other Linux distributions, you can check out our guide on how to install Docker on Ubuntu 24.04, which covers installing the latest Docker packages.
Before you begin:
Docker is available in the default package repositories on Rocky Linux 9, but the version information may not be the latest. Follow the steps below add the latest repository information and install Docker on your server using the default DNF package manager.
Install the dnf-utils package.
Add the official Docker repository to your package sources.
Install Docker and all required dependency packages such as containerd.io.
The Docker engine uses the docker systemd service to run and manage the daemon processes on your server. Only privileged users can access Docker CLI and manage the containerized application processes. Follow the steps below to manage the Docker system service and enable unprivileged system users to use Docker CLI to manage containerized applications on the server.
Enable the Docker service to automatically start at system boot.
Start the Docker service.
View the Docker service status and verify that it's running.
Output:
The Docker service is active and running on your server based on the active (running) prompt in the above output.
Stop the Docker service.
Restart the Docker service.
Add your non-root user to the Docker group to run Docker CLI commands without sudo privileges. Replace linuxuser with your actual username.
Enable the new user group changes in your active session.
Docker can find and run applications from container image sources such as Docker Hub. Follow the steps below to deploy a sample containerized application using the hello world image from Docker Hub and verify the container processes on your server.
Pull the crccheck/hello-world Docker image from Docker Hub.
List all Docker images available on your server and verify that the new image is available.
Output:
Deploy a new containerized application using the hello-world Docker image.
The above command runs a new Docker container with the following configuration:
-d: Starts the container in detached mode as a background process.--name web-test: Assigns the containerized application name web-test for identification and management.-p 80:8000: Maps the localhost port 80 to the container port 8000 to enable access the containerized application.crccheck/hello-world: Sets the Docker image to use when creating the containerList all active Docker containers running on your server.
Verify that the web-test container is active running similar to the following output.
Access your localhost port 80 using the curl utility and verify that your application responds to user requests.
Output:
Access your server IP address using a web browser such as Chrome and verify that your application's graphical interface page displays.
Output:
Run the following command to stop the Docker container.
Docker supports private and public container registries such as the Vultr container registry to build, store and deploy container images. Follow the steps below to use Docker with your Vultr Container Registry to deploy containerized applications on the server.
Access your Vultr Container Registry's management page and copy the docker login command in the Example Commands section that contains all necessary credentials.
Run the docker login in your terminal session to log in to the Vultr Container Registry. Replace exampleregistry, example-user, and registry-key with your actual details.
Your output should be similar to the one below when successful:
Tag the crccheck/hello-world Docker image with your desired Vultr Container Registry repository name.
List all Docker images and verify that the new tagged image is available.
Output:
Push the tagged Docker image to your Vultr Container Registry.
Your output should be similar to the one below.
Access your Vultr Container Registry's management page, navigate to the Repositories tab and verify that the new Docker image repository is available.
Deploy a new container using your Vultr Container Registry Docker image.
List all active Docker containers running on your server.
Verify that the web-test-vcr container is running similar to the following output.
You have installed Docker on Rocky Linux 9 and deployed containerized applications on your server. Docker supports multiple container image sources you can use to run containerized applications on your server. For more information and Docker CLI options, visit the Docker reference documentation.
0 Comments
Be the first to comment and share your perspective with the community.