Caddy file server that serves files from S3-compatible object storage using the caddy-fs-s3
1.6K
A Dockerized Caddy file server that serves files from S3-compatible object storage using the caddy-fs-s3 module.
See the github repository https://github.com/wisicn/docker-caddy-s3
git clone https://github.com/yourusername/docker-caddy-s3.git
cd docker-caddy-s3
Create a .env file based on the example:
cp .env.example .env
Edit .env with your credentials:
# AWS/S3 Credentials
AWS_ACCESS_KEY_ID=your-access-key-id
AWS_SECRET_ACCESS_KEY=your-secret-access-key
# Web Server Port (default: 18808)
WEB_PORT=18808
# User/Group IDs (optional)
PUID=1000
PGID=1000
Edit Caddyfile to match your S3 configuration:
{
http_port {$CADDY_PORT:80}
filesystem my-s3-fs s3 {
bucket your-bucket-name
region us-east-1
# endpoint https://s3.us-east-1.amazonaws.com
# profile <profile>
# use_path_style
}
}
http:// {
file_server {
browse
hide .DS_Store ._.DS_Store ._*
fs my-s3-fs
}
}
docker-compose up -d
Access the file server at http://localhost:18808 (or your configured WEB_PORT).
| Variable | Description | Required | Default |
|---|---|---|---|
AWS_ACCESS_KEY_ID | S3 access key ID | Yes | - |
AWS_SECRET_ACCESS_KEY | S3 secret access key | Yes | - |
WEB_PORT | Port to expose the file server | No | 18808 |
CADDY_PORT | Internal Caddy port | No | 80 |
PUID | User ID to run as | No | 1000 |
PGID | Group ID to run as | No | 1000 |
The S3 filesystem module supports the following options:
| Option | Description |
|---|---|
bucket | S3 bucket name |
region | S3 region (e.g., us-east-1, ap-singapore) |
endpoint | Custom S3 endpoint URL |
profile | AWS profile name from credentials file |
use_path_style | Use path-style addressing instead of virtual-hosted style |
This configuration works with:
https://s3.amazonaws.comhttps://cos.{region}.myqcloud.comhttps://{region}.aliyuncs.comhttps://s3.wasabisys.comhttps://{region}.digitaloceanspaces.comTo build the Docker image locally:
docker build -t docker-caddy-s3 .
docker run -d \
--name docker-caddy-s3 \
-p 18808:80 \
-e AWS_ACCESS_KEY_ID=your-access-key \
-e AWS_SECRET_ACCESS_KEY=your-secret-key \
-v $(pwd)/Caddyfile:/etc/caddy/Caddyfile \
docker-caddy-s3
docker-compose logs -f
Ensure your credentials have the necessary permissions:
s3:GetObjects3:ListBucketThis project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request. The function is being upgraded
Content type
Image
Digest
sha256:c5ca943ab…
Size
40.7 MB
Last updated
6 months ago
docker pull wisicn/docker-caddy-s3