How To Install Caddy Web Server By Docker On Rocky Linux 8.6
To Install Caddy Web Server By Docker On Rocky Linux 8.6
Introduction:
Caddy is a Go language-based open-source, extensile, platform-independent web server. It is the only web server that uses HTTPS by default. It is both a tool for helping with tedious tasks and a way to organize multiple parts into a simplified system.
Installation 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_VERSI
Step 2: Create a Web content by using the below command
[root@linuxhelp ~]# vim index.html
<h1 data-style="background-color:DodgerBlue;">Welcome To Linuxhelp </h1>
<p data-style="background-color:Tomato;"> Installation of Caddy Web Server by Docker on Rocky Linux 8.6 </p>
Step 3: Pull the Caddy Image from Docker Hub by using the below command
[root@linuxhelp ~]# docker pull caddy
Using default tag: latest
latest: Pulling from library/caddy
530afca65e2e: Pull complete
4ba0a25d6623: Pull complete
7a501877fabb: Pull complete
d2c62335257e: Pull complete
4e4608ab095f: Pull complete
Digest: sha256:f51603577fef8abe01dfda4b5ef85b3acf2844a6b3d0db873f5119f57db5de57
Status: Downloaded newer image for caddy:latest
docker.io/library/caddy:latest
Step 4: Run the Container with name “webserver” with mapping the Port 80 to the host and defining volume for web content and data directory by using the below command
[root@linuxhelp ~]# docker run --name webserver -p 80:80 -v $PWD/index.html:/usr/share/caddy/index.html -v caddy_data:/data caddy
{"level":"info","ts":1658780754.78602,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
{"level":"info","ts":1658780754.816135,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"warn","ts":1658780754.8164184,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
{"level":"info","ts":1658780754.8175206,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1658780754.8175352,"msg":"serving initial configuration"}
{"level":"info","ts":1658780754.817722,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00019b340"}
{"level":"info","ts":1658780754.8177469,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}
{"level":"info","ts":1658780754.81776,"logger":"tls","msg":"finished cleaning storage units"}
Step 5: Ping the Host system’s IP address on Browser as shown in the below image
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to Install Caddy Web Server by Docker on Rocky Linux 8.6 . Your feedback is much welcome.