[LINUX] Start Caddy with docker without putting Caddy in CentOS8


What is Caddy

When I go to Caddy's site, it says "Big Deca" and proudly. THE ULTIMATE SERVER It's hard to say so far. Caddy is an open source web server whose first edition is new as April 28, 2015. It is written in Go language and uses the Go standard library for HTTP functions. Also, unlike other web servers, it uses HTTPS by default.

Start Caddy without inserting Caddy in CentOS8

Last time I started Nginx using docker without putting Nginx in CentOS 8, but the same thing Try it with Caddy. Click here for Qiia's article. 2020-10-21_182034.png


It was confirmed last time, but the environment again. CentOS Linux release 8.2.2004 (Core) Docker version 19.03.13, build 4484c46d9d

Start Caddy with docker without Caddy in CentOS8

Check that there is no docker container or image. # docker ps -a # docker images 2020-10-21_180219.png Start Caddy

80 caddy

```# docker ps -a```
```# docker images```
<a href="https://ebios10.up.seesaa.net/image/2020-10-21_180252.png " target="_blank"><img border="0" alt="2020-10-21_180252.png " src="https://ebios10.up.seesaa.net/image/2020-10-21_180252-thumbnail2.png " width="640" height="141"></a>
 I was able to pull the caddy and even start the container without doing anything special.

# Access localhost: 8081 in Firefox
 Access localhost: 8081 in Firefox. 8081 is because I specified "-p 8081: 80" in docker run.
<a href="https://ebios10.up.seesaa.net/image/2020-10-21_172725.png " target="_blank"><img border="0" alt="2020-10-21_172725.png " src="https://ebios10.up.seesaa.net/image/2020-10-21_172725-thumbnail2.png " width="640" height="498"></a>
 I was able to confirm that Caddy was working without any problems.
 Starting Caddy with docker was easy, without any stumbling blocks.

# Location of Caddy config file and index.html
 Nothing happened until Caddy started, so touch the Caddy container a little and check the location of the Caddy configuration file and index.html.
```# docker exec -it testcaddy /bin/ash```
```# cd /etc/caddy```
```# ls```
```# cat caddyfile```
<a href="https://ebios10.up.seesaa.net/image/2020-10-21_180526.png " target="_blank"><img border="0" alt="2020-10-21_180526.png " src="https://ebios10.up.seesaa.net/image/2020-10-21_180526-thumbnail2.png " width="608" height="541"></a>

#### **`# Set this path to your site's directory.`**

root * /usr/share/caddy Is set. # cd /usr/share/caddy # ls

# cat index.html

<a href="https://ebios10.up.seesaa.net/image/2020-10-21_180618.png " target="_blank"><img border="0" alt="2020-10-21_180618.png " src="https://ebios10.up.seesaa.net/image/2020-10-21_180618-thumbnail2.png " width="410" height="147"></a>
 I was able to confirm that index.html exists under / usr / share / caddy as set.
 If you want to try Caddy, it seems easy and good to do it with docker.

Recommended Posts

Start Caddy with docker without putting Caddy in CentOS8
Start Nginx with docker without putting Nginx in CentOS8
Until you start Jupyter with Docker
Build a CentOS Linux 8 environment with Docker and start Apache HTTP Server
How to install python3 with docker centos
Hello World with gRPC / go in Docker environment
mod_wsgi talks about putting it in with pip
Start Django in a virtual environment with Pipenv
Start a simple Python web server with Docker
How to start the code written in Atom with one command without starting teminal
Play with CentOS 8
Change the time zone with Docker in Oracle Database
Japanese can be used with Python in Docker environment
Start numerical calculation in Python (with Homebrew and pip)