The Nautilus application development team shared static website content that needs to be hosted on the httpd web server using a containerised platform. The team has shared details with the DevOps team, and we need to set up an environment according to those guidelines. Below are the details:
a. On App Server 3 in Stratos DC create a container named httpd using a docker compose file /opt/docker/docker-compose.yml (please use the exact name for file).
b. Use httpd (preferably latest tag) image for container and make sure container is named as httpd; you can use any name for service.
c. Map 80 number port of container with port 6000 of docker host.
d. Map container's /usr/local/apache2/htdocs volume with /opt/itadmin volume of docker host which is already there. (please do not modify any data within these locations).
Connect to App Server 3
ssh banner@stapp03
sudo -i
Password for banner: BigGr33n
Create the Docker Directory
mkdir -p /opt/docker
Verify the Host Volume Exists
ls -la /opt/itadmin
Output:
total 16
drwxr-xr-x 2 root root 4096 Oct 27 11:34 .
drwxr-xr-x 1 root root 4096 Oct 27 11:34 ..
-rw-r--r-- 1 root root 34 Oct 27 11:34 index1.html
The host directory /opt/itadmin exists and contains the static website content (index1.html).
Create the Docker Compose File
vi /opt/docker/docker-compose.yml
Add the following content:
version: '3.8'
services:
httpd:
image: httpd:latest
container_name: httpd
ports:
- "6000:80"
volumes:
- /opt/itadmin:/usr/local/apache2/htdocs
Verify the file:
cat /opt/docker/docker-compose.yml
Output:
version: '3.8'
services:
httpd:
image: httpd:latest
container_name: httpd
ports:
- "6000:80"
volumes:
- /opt/itadmin:/usr/local/apache2/htdocs
Start the Container Using Docker Compose
cd /opt/docker
docker compose up -d
Output:
WARN[0000] /opt/docker/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] up 9/9
✔ Image httpd:latest Pulled 4.9s
✔ Network docker_default Created 0.1s
✔ Container httpd Created 0.1s
The warning about the version attribute is informational only; it does not affect functionality.
Verify the Container is Running
docker ps | grep httpd
Output:
c1795d69f717 httpd:latest "httpd-foreground" 5 seconds ago Up 4 seconds 0.0.0.0:6000->80/tcp, :::6000->80/tcp httpd
The container httpd is running and port 6000 is mapped to container port 80.
Verify the Port Mapping
docker port httpd
Output:
80/tcp -> 0.0.0.0:6000
80/tcp -> [::]:6000
Verify the Volume Mapping
docker inspect httpd --format='{{range .Mounts}}{{.Source}} -> {{.Destination}}{{end}}'
Output:
/opt/itadmin -> /usr/local/apache2/htdocs
The host /opt/itadmin is correctly mapped to the container document root.
Test the Website
curl -I http://localhost:6000/
Output:
HTTP/1.1 200 OK
Date: Tue, 27 Oct 2026 11:37:44 GMT
Server: Apache/2.4.69 (Unix)
Content-Type: text/html;charset=ISO-8859-1
The HTTP 200 OK response confirms the web server is accessible on host port 6000.
Complete Command Sequence
ssh banner@stapp03
sudo -i
mkdir -p /opt/docker
cat > /opt/docker/docker-compose.yml << 'EOF'
version: '3.8'
services:
httpd:
image: httpd:latest
container_name: httpd
ports:
- "6000:80"
volumes:
- /opt/itadmin:/usr/local/apache2/htdocs
EOF
cat /opt/docker/docker-compose.yml
cd /opt/docker
docker compose up -d
docker ps | grep httpd
docker port httpd
docker inspect httpd --format='{{range .Mounts}}{{.Source}} -> {{.Destination}}{{end}}'
curl -I http://localhost:6000/
Top comments (0)