Docker installation guide.
To download the latest Ferron image from Docker Hub, run the following command:
docker pull ferronserver/ferron:2
Once the image is downloaded, start a Ferron container using the following command:
docker run --name myferron -d -p 80:80 --restart=always ferronserver/ferron:2
This command does the following:
--name myferron
: Assigns a name (myferron
) to the running container.-d
: Runs the container in detached mode.-p 80:80
: Maps port 80 of the container to port 80 on the host machine.--restart=always
: Ensures the container automatically restarts if it stops or if the system reboots.To confirm that Ferron is running, execute:
docker ps
This should display a running container with the name myferron
.
To test the web server, open a browser and navigate to http://localhost
. You should see the default Ferron welcome page.
Alternatively, use curl
:
curl http://localhost
Ferron on Docker has following file structure:
To stop the Ferron container, run:
docker stop myferron
To restart the container:
docker start myferron
If you need to remove the Ferron container:
docker rm -f myferron
If you’re using Docker Compose, you can define a service for Ferron in your docker-compose.yml
file:
services:
ferron:
image: ferronserver/ferron:2
ports:
- "80:80"
restart: always
Then, you can start Ferron using:
docker-compose up -d
If using Ferron with Docker Compose and automatic TLS, you can use the following docker-compose.yml
file contents:
services:
# Ferron container
ferron:
image: ferronserver/ferron:2
ports:
- "80:80"
- "443:443"
volumes:
- "./ferron.kdl:/etc/ferron.kdl" # Ferron configuration file
- "ferron-acme:/var/cache/acme-cache" # This volume is needed for persistent automatic TLS cache, otherwise the web server will obtain a new certificate on each restart
restart: always
depends_on:
ferron-acme-change-vol-ownership:
condition: service_completed_successfully
# Container to change ownership of the volume, necessary for the ACME cache to work properly
ferron-acme-change-vol-ownership:
image: alpine
user: "root"
volumes:
- ferron-acme:/tmp/change-ownership
command: chown nobody:nogroup /tmp/change-ownership
volumes:
ferron-acme:
You might also configure Ferron in a “ferron.kdl” file like this:
* {
auto_tls_cache "/var/cache/acme-cache"
}
// Replace "example.com" with your website's domain name
example.com {
root "/var/www/ferron"
}
Then, you can start Ferron using:
docker-compose up -d