• 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 Install Caddy Web Server by Docker on Ubuntu 21.04

  • 00:37 lsb_release -a
  • 00:53 echo "hello world" > index.html
  • 01:22 docker pull caddy
{{postValue.id}}

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 snap 1

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.

Tags:
matthew
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Q What is Caddy?

A

Caddy 2 is an enterprise-ready, open-source web server written in Go with automatic HTTPS.

Q

Q2 How does a Caddy server work?

A

Image result for caddy server
Caddy is the only web server that automatically and by default uses HTTPS.

Q

Q3 What special features of Caddy?

A

Caddy automatically obtains and renews TLS certificates for your website.

Q

Q4 Who uses the Caddy server?

A

Caddy Server is typically used by businesses with 1-10 employees and 1M-10M in revenue.

Q

Q5 Does Caddy need port 80?

A

Yes, port 80 must be externally accessible.

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.