A simple maintenance page in a simple docker image.
- Introduction
- Environment variables.
- Docker.
- Docker Compose.
- Live demo: Click Here!
This image came as a result for the need to place a simple maintenance page in times of server downtime or maintenance. The main requirement was to use a simple static HTML file.
This led us to the gist here. To make it so that it may be fit for most general use cases, We modified some of the elements in the HTML to introduce variables that can be customized for different deployments.
We introduced a few variables that would affect different parts of the maintenance page as shown below.
| Variable | Description |
|---|---|
MAIL_ADDRESS |
This modifies the email address provided for the contact us link in the page. Defaults to mail@example.com |
TEAM_NAME |
Modifies the team or company name displayed on the page. Defaults to The Team |
TITLE |
Modifies the site title displayed. Defaults to Site Maintenance |
LINK_COLOR |
Modifies the link color for the contact us link. Defaults to #dc8100 |
PORT |
Specifies the port to serve the maintenance page. Defaults to 8080 |
RESPONSE_CODE |
Specifies the HTTP response code to serve with the maintenance page. Defaults to 503 Service Unavailable |
You can easily run or create a docker container for this image by using the command:
docker run -p 80:8080 wickerlabs/maintenance
This will serve the default static maintenance page on port 80 of the host machine. You can modify specific variables within the run command which would then look like:
docker run -e TEAM_NAME='Team name' -e TITLE='Oops!' -e MAIL_ADDRESS=mail@domain.com -e PORT=9000 --rm -p 80:9000 wickerlabs/maintenance
For docker compose, you can choose to refer to the docker-compose.yml file in the repo or you can have look at the example below.
version: '3.5'
services:
maintenance:
image: wickerlabs/maintenance
container_name: maintenance-page
environment:
TEAM_NAME: "Team name"
TITLE: "Oops!"
MAIL_ADDRESS: "mail@domain.com"
LINK_COLOR: "#dc8100"
PORT: 8080
RESPONSE_CODE: "503 Service Unavailable"
ports:
- 80:8080