• 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 Build Docker image using Docker files on Rocky Linux 8.6

  • 00:40 cat /etc/os-release
  • 01:18 systemctl status docker
  • 02:02 mkdir /dockerfiles
  • 02:20 vim /dockerfiles/dockerfile
  • 04:02 docker build /dockerfiles/
  • 04:39 docker images
  • 07:16 docker run a3cfdca80718
{{postValue.id}}

To build Docker image using Docker files on Rocky Linux 8.6

Introduction:

A Docker image is an unchanging file that contains source code, libraries, dependencies, tools, and other files necessary to run a program.

Installation Procedure:

Step 1: Check the OS version

[root@linuxhelp ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.6 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.6 (Green Obsidian)"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky Linux"
ROCKY_SUPPORT_PRODUCT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

Step 2: check the status of docker

[root@linuxhelp ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor pre>
   Active: active (running) since Fri 2022-07-22 02:35:59 EDT; 2 weeks 2 days a>
     Docs: https://docs.docker.com
 Main PID: 43049 (dockerd)
    Tasks: 9
   Memory: 47.0M
   CGroup: /system.slice/docker.service
           └─43049 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/conta>

Step 3: To create directory for the docker file

[root@linuxhelp ~]# mkdir /dockerfiles

Step 4: To open the configuration file

[root@linuxhelp ~]# vim /dockerfiles/dockerfile
#Getting image from docker hub
FROM httpd
RUN apt-get update
CMD ["echo","Apache web server image"]

Step 5: To run the docker build

[root@linuxhelp ~]# docker build /dockerfiles/
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM httpd
latest: Pulling from library/httpd
1efc276f4ff9: Pull complete 
aed046121ed8: Pull complete 
4340e7be3d7f: Pull complete 
80e368ef21fc: Pull complete 
80cb79a80bbe: Pull complete 
Digest: sha256:343452ec820a5d59eb3ab9aaa6201d193f91c3354f8c4f29705796d9353d4cc6
Status: Downloaded newer image for httpd:latest
 ---> f2a976f932ec
Step 2/3 : RUN apt-get update
 ---> Running in e55ed9b99dfb
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8182 kB]
Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [170 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2592 B]
Fetched 8563 kB in 3s (2584 kB/s)
Reading package lists...
Removing intermediate container e55ed9b99dfb
 ---> 320678b9ed02
Step 3/3 : CMD ["echo",Apache web server image"]
 ---> Running in a1f0e21a467e
Removing intermediate container a1f0e21a467e
 ---> 8ec0e4647349
Successfully built 8ec0e4647349

Step 6: check the docker image

[root@linuxhelp ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED          SIZE
<none>        <none>    a3cfdca80718   18 seconds ago   163MB
httpd         latest    f2a976f932ec   5 days ago       145MB
hello-world   latest    feb5d9fea6a5   10 months ago    13.3kB

Step 7: Run the docker images by using image ID

[root@linuxhelp ~]# docker run a3cfdca80718
Apache web server image

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Build Docker image using Docker files on Rocky Linux 8.6. Your feedback is much welcome.

Tags:
matthew
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is a Docker Image?

A

A Docker image is an unchangeable file that contains the source code, libraries, dependencies, tools, and other files needed for an application to run.

Q

What is a Docker Container?

A

A Docker container is a virtualized run-time environment where users can isolate applications from the underlying system.
These containers are compact, portable units in which you can start up an application quickly and easily.

Q

Is it possible to create Docker image?

A

Yes, This script is called a Dockerfile.

Q

Which command is used to create a Docker image from a Dockerfile?

A

To create a Docker image from a Dockerfile use the command "docker build".

Q

Does Docker have OS images?

A

Yes, its have OS images.

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 Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

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.