• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How To Create A Container In Docker To Run An Application On Rocky Linux 9.5

  • 00:25 cat /etc/os-release
  • 00:44 curl https://get.docker.com/ | bash
  • 01:20 docker version
  • 01:32 docker ps
  • 01:40 docker pull nginx:latest
  • 02:17 docker images
  • 02:27 docker run -d –name nginx -p 8000:80 b52e0b094bc0
  • 02:56 docker ps
  • 03:08 ip a
{{postValue.id}}

To Create A Container In Docker To Run An Application On Rocky linux 9.5

Introduction

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker's methodologies for shipping, testing, and deploying code, you can significantly reduce the delay between writing code and running it in production.

Procedure:

Step 1: Check OS Version

[root@localhost linuxhelp]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.5 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.5"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.5 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
VENDOR_NAME="RESF"
VENDOR_URL="https://resf.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.5"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.5"

Step 2: Install Docker

root@localhost linuxhelp]# curl https://get.docker.com/ | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 22592  100 22592    0     0   195k      0 --:--:-- --:--:-- --:--:--  196k
# Executing docker install script, commit: 4c94a56999e10efcf48c5b8e3f6afea464f9108e
Warning: the "docker" command appears to already exist on this system.

If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.

If you installed the current Docker package using this script and are using it
again to update Docker, you can ignore this message, but be aware that the
script resets any custom changes in the deb and rpm repo configuration
files to match the parameters passed to the script.

You may press Ctrl+C now to abort this script.
+ sleep 20

Step 3: Check version of Docker

root@localhost linuxhelp]# docker version
Client: Docker Engine - Community
 Version:           28.0.1
 API version:       1.48
 Go version:        go1.23.6
 Git commit:        068a01e
 Built:             Wed Feb 26 10:42:23 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.0.1
  API version:      1.48 (minimum version 1.24)
  Go version:       go1.23.6
  Git commit:       bbd0a17
  Built:            Wed Feb 26 10:40:43 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.25
  GitCommit:        bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc:
  Version:          1.2.4
  GitCommit:        v1.2.4-0-g6c52b3f
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Step 4: Check Docker containers

root@localhost linuxhelp]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

Step 5: Run docker pull command then getting image from the docker hub repository

root@localhost linuxhelp]# docker pull nginx:latest
latest: Pulling from library/nginx
66a3d608f3fa: Pull complete 
58290db888fa: Pull complete 
5d777e0071f6: Pull complete 
dbcfe8732ee6: Pull complete 
37d775ecfbb9: Pull complete 
e0350d1fd4dd: Pull complete 
1f4aa363b71a: Pull complete 
e74fff0a393a: Pull complete 
Digest: sha256:814a8e88df978ade80e584cc5b333144b9372a8e3c98872d07137dbf3b44d0e4
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest

Step 6: Check Docker images

root@localhost linuxhelp]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
nginx        latest   b52e0b094bc0   3 weeks ago   192MB

Step 7: Run Docker container

root@localhost linuxhelp]# docker run -d –name nginx -p 8000:80 b52e0b094bc0
b8b1ce210a0ce2047222845ba1260aca4b9537a1508465421ed699429f186477

Step 8: Check Docker Container

root@localhost linuxhelp]# docker ps
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS                                   NAMES
a5141fd985af   b52e0b094bc0   "/docker-entrypoint.…"   37 seconds ago   Up 34 seconds   0.0.0.0:8001->80/tcp, :::8001->80/tcp   nginx

Snap1

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to create containers in Docker. Your feedback is much welcome.

Tags:
aiden
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

1. What is Docker?

A

Docker is an open-source containerization platform. It is used to automate the deployment of any application, using lightweight, portable containers.

Q

2. Why should anyone use Docker? What does it offer?

A

Docker gives users many incentives for adoption, such as:
• An efficient and easy initial setup experience
• The means to describe an application lifecycle in detail
• Simple configuration and smooth interaction with Docker Compose
• Complete and well-detailed documentation
• Ability to run on a PC or enterprise IT system with equal ease

Q

3. What is a container?

A

Containers are deployed applications bundled with all necessary dependencies and configuration files. All of the elements share the same OS kernel. Since the container isn’t tied to any one IT infrastructure, it can run on a different system or the cloud.

Q

4. What’s the difference between virtualization and containerization?

A

Virtualization is an abstract version of a physical machine, while containerization is the abstract version of an application.

Q

5. Name and explain the various Docker components.

A

The three main Docker components are:
1. Docker Client. Performs Docker build pull, and run operations to open up communication with the Docker Host. The Docker command then employs the Docker API to call any queries to run.
2. Docker Host. Contains Docker daemon, containers, and associated images. The Docker daemon establishes a connection with the Registry. The stored images are a type of metadata dedicated to containerized applications.
3. Registry. This is where Docker images are stored. There are two of them, a public registry and a private one Docker Hub and Docker Cloud are two public registries available for use by anyone.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Isaiah ?
What is the use of SUID & SGID commands

How to set the special permissions to the files and folders using SUID and SGID commands...

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.