mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-17 12:00:44 +02:00
Quick-Start-with-weed-mini: add Run with Docker section (#9247)
@@ -69,6 +69,88 @@ weed mini -dir=/data -s3.externalUrl=https://s3.example.com
|
||||
|
||||
For more configuration details, see the **[[S3 Nginx Proxy]]** page.
|
||||
|
||||
## Run with Docker
|
||||
|
||||
The `chrislusf/seaweedfs` image runs `weed mini -dir=/data` by default, so no command arguments are required.
|
||||
|
||||
### Simple `docker run`
|
||||
|
||||
```bash
|
||||
docker run -d --name weed-mini \
|
||||
-p 8333:8333 -p 8888:8888 -p 9333:9333 -p 23646:23646 \
|
||||
-e AWS_ACCESS_KEY_ID=admin \
|
||||
-e AWS_SECRET_ACCESS_KEY=secret \
|
||||
chrislusf/seaweedfs
|
||||
```
|
||||
|
||||
Exposed ports:
|
||||
- `8333` — S3 endpoint
|
||||
- `8888` — Filer UI
|
||||
- `9333` — Master UI
|
||||
- `23646` — Admin UI
|
||||
|
||||
`AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` seed the initial IAM credentials for the `mini` user at startup. Without them the S3 gateway starts in "Allow All" mode (see [Default S3 Access](#default-s3-access)).
|
||||
|
||||
### Persisting data across restarts
|
||||
|
||||
Mount a named volume (or a host path) at `/data`:
|
||||
|
||||
```bash
|
||||
docker run -d --name weed-mini \
|
||||
-p 8333:8333 \
|
||||
-v weed-data:/data \
|
||||
-e AWS_ACCESS_KEY_ID=admin \
|
||||
-e AWS_SECRET_ACCESS_KEY=secret \
|
||||
chrislusf/seaweedfs
|
||||
```
|
||||
|
||||
### Create the first bucket
|
||||
|
||||
Use the built-in `weed shell` — it talks directly to the master, so there's no AWS CLI to install and no credentials to set up:
|
||||
|
||||
```bash
|
||||
docker exec -i weed-mini weed shell <<< "s3.bucket.create -name my-bucket"
|
||||
docker exec -i weed-mini weed shell <<< "s3.bucket.list"
|
||||
```
|
||||
|
||||
For an interactive prompt, run `docker exec -it weed-mini weed shell` and type `help` to see all commands (`s3.bucket.create`, `s3.bucket.list`, `s3.bucket.delete`, etc.).
|
||||
|
||||
### Use as a GitHub Actions service container
|
||||
|
||||
GitHub Actions service containers cannot pass arguments to the image entrypoint, so the default `CMD` is what makes the image work directly under `services:`:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
seaweedfs:
|
||||
image: chrislusf/seaweedfs
|
||||
ports:
|
||||
- 8333:8333
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: admin
|
||||
AWS_SECRET_ACCESS_KEY: secret
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: admin
|
||||
AWS_SECRET_ACCESS_KEY: secret
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
S3_ENDPOINT: http://localhost:8333
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Wait for S3 endpoint
|
||||
run: |
|
||||
for _ in $(seq 1 60); do
|
||||
curl -sfo /dev/null "$S3_ENDPOINT/" && exit 0
|
||||
sleep 1
|
||||
done
|
||||
echo "S3 endpoint did not become ready" >&2
|
||||
exit 1
|
||||
- name: Create the test bucket
|
||||
run: aws --endpoint-url "$S3_ENDPOINT" s3 mb s3://my-bucket
|
||||
- run: ./run-tests.sh
|
||||
```
|
||||
|
||||
## S3 Credentials Setup
|
||||
|
||||
### Option 1: Environment Variables (Recommended)
|
||||
|
||||
Reference in New Issue
Block a user