Clone
7
Environment Variables
chrislusf edited this page 2025-07-23 11:45:04 -07:00

Environment Variables

You can use environment variables instead of arguments for weed.
For example:
instead of weed master -port 5000 -mdir /tmp -volumePreallocate -ip.bind 0.0.0.0 you can use

export IP_BIND=0.0.0.0
export PORT=5000
export MDIR=/tmp
export VOLUMEPREALLOCATE=true # or export VOLUMEPREALLOCATE=
weed master

Weed prefix

For v, logtostderr, stderrthreshold, vmoudle, options, logdir, alsologtostderr, log_backtrace_at , and config_dir you have to use WEED_ as prefix for environment variable like this WEED_CONFIG_DIR=/tmp

S3 Admin Credentials

For S3 API server authentication, see the dedicated S3 Credentials page which covers:

  • Configuration file setup (highest priority)
  • Filer configuration (medium priority)
  • Environment variables as fallback (lowest priority)
  • AWS standard environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
  • Complete authentication examples and troubleshooting

Docker

You can set environment variables easily in Docker:

docker run --name master -d -p 9333:9333 -p 19333:19333 \
  -e MDIR="/data" -e PORT="9333" \
  chrislusf/seaweedfs:latest \
  master 

Docker Compose with Environment Variables

version: '3.9'
services:
  master:
    image: chrislusf/seaweedfs:latest
    ports:
      - 9333:9333
      - 19333:19333
    environment:
      IP_BIND: 0.0.0.0
      MDIR: /data
      PORT: 9333
      VOLUMEPREALLOCATE: 'true'
      # or `VOLUMEPREALLOCATE:`
    entrypoint: weed
    command: master 

  filer:
    image: chrislusf/seaweedfs:latest
    ports:
      - 8888:8888
    environment:
      # ... other filer environment variables
    entrypoint: weed
    command: filer -master=master:9333
  
  s3:
    image: chrislusf/seaweedfs:latest
    ports:
      - 8333:8333
    environment:
      AWS_ACCESS_KEY_ID: s3admin
      AWS_SECRET_ACCESS_KEY: s3secret
    entrypoint: weed
    command: s3 -filer=filer:8888
    depends_on:
      - filer