How to Install Caddy Web Server by Docker on Ubuntu 21.04
To Install Caddy Web Server by Docker on Ubuntu 21.04
Introduction:
Caddy is an open-source, extensile, platform-independent web server written in Go. 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:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute
Step 2: Create a Web content by using the below command
root@linuxhelp:~# echo "hello world" > index.html
add.add
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
97518928ae5f: Pull complete
23ccae726125: Pull complete
3de6a61c89ac: Pull complete
39ed957bdc00: Pull complete
0ae44c2d42dd: Pull complete 1
Digest: sha256:4916ad44f7563c0dd767d900ffafee75016f01e3c966b3c46e6c2f7bc896b2be
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":1647213382.805626,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
{"level":"info","ts":1647213382.8084857,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
{"level":"info","ts":1647213382.8095517,"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":1647213382.8097925,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000290fc0"}
{"level":"info","ts":1647213382.8105195,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}
{"level":"info","ts":1647213382.8106756,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"info","ts":1647213382.8110354,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
Step 5: Ping the Host system’s IP address on Browser as show in the below image

add.add
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to caddy web server by docker on ubuntu 21.04. Your feedback is much welcome.
Comments ( 0 )
No comments available