• 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 Apache Web Server By Docker On Rocky Linux 8.6

  • 00:33 cat /etc/os-release
  • 01:05 docker run -dit --name webhost -p 8080:80 -v /home/user/website/:/usr/local/apache2/htdocs/ httpd:2.4
  • 02:35 docker ps
  • 02:45 vim /home/user/website/index.html
{{postValue.id}}

To Create Apache Web Server By Docker On Rocky Linux 8.6

Introduction:

Docker is an open-source software platform for creating, deploying, and managing virtualized application containers. Reverse proxy servers are generally behind a firewall in private networks, and they forward client requests to the relevant backend servers.

Procedure:

Step 1: Check the OS version by using the below command

[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: Mapping the location /home/user/website/ location by using the below command

[root@linuxhelp ~]# docker run -dit --name webhost -p 8080:80 -v /home/user/website/:/usr/local/apache2/htdocs/ httpd:2.4
Unable to find image 'httpd:2.4' locally
2.4: Pulling from library/httpd
461246efe0a7: Pull complete 
d6bc17b4451a: Pull complete 
72dcd3e40e39: Pull complete 
c332ae8365a7: Pull complete 
97f4b88189d8: Pull complete 
Digest: sha256:75d370e19ec2a456b6c80110fe30694ffcd98fc85151a578e14334a51eb94578
Status: Downloaded newer image for httpd:2.4
2e60fb41d6337e6dd476f63e8b3c5480d2fe9396b952a6d1375499357bc97c31

Step 3: View the docker image by using the below command

[root@linuxhelp ~]# docker ps
CONTAINER ID   IMAGE       COMMAND              CREATED          STATUS          PORTS                                   NAMES
2e60fb41d633   httpd:2.4   "httpd-foreground"   13 seconds ago   Up 11 seconds   0.0.0.0:8080->80/tcp, :::8080->80/tcp   webhost

Step 4: Now create a simple web page named by index.html inside the /home/user/website directory by using the below command

[root@linuxhelp ~]# vim /home/user/website/index.html
<!DOCTYPE html>
<html lang="en">
<body>
    <h1>Welcome to linuxhelp</h1>
</body>
</html>

Step 5: Go to browser and ping Server-IP:8080 as shown in the below image

snap 1

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to create Apache Web Server by Docker on Rocky Linux 8.6. Your feedback is much welcome.

Tags:
markdjokovic
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is a Reverse proxy server?

A

A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network.

Q

How to enable the Nginx Server Block?

A

To enable the Nginx Server Block by "ls -s /etc/nginx/sites-available /etc/nginx/sites-enabled"

Q

How to execute a command on Container?

A

To execute a command on Container by "docker exec "

Q

What is the purpose of Flag -t on docker run Command?

A

The purpose of Flag -t on docker run Command is to Allocate a pseudo-TTY

Q

How to Map the container port to the host port?

A

To Map the container port to the host port use the flag docker run -p with

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 Gibbson ?
How do i run both nginx and apache in same instance on centos

Hi...,

my server is based centos operating system and my webserver is already running on Apache.... i need to run both apache and nginx on same instance ... please help me to implement this concept...

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.