Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Flower Framework
Logo
main

Tutorial

  • What is Federated Learning?
  • Get started with Flower
  • Use a federated learning strategy
  • Build a strategy from scratch
  • Customize the client
  • Quickstart tutorials
    • Quickstart PyTorch
    • Quickstart TensorFlow
    • Quickstart MLX
    • Quickstart 🤗 Transformers
    • Quickstart JAX
    • Quickstart Pandas
    • Quickstart fastai
    • Quickstart PyTorch Lightning
    • Quickstart scikit-learn
    • Quickstart XGBoost
    • Quickstart Android
    • Quickstart iOS

How-to Guides

  • Build
    • Install Flower
    • Configure Clients
    • Design stateful ClientApps
    • Use strategies
    • Implement strategies
    • Aggregate evaluation results
    • Save and Load Model Checkpoints
    • Use Built-in Mods
    • Use Differential Privacy
    • Implement FedBN
    • Use CLI JSON output
    • Upgrade to Flower 1.0
    • Upgrade to Flower 1.13
  • Simulate
    • Run simulations
  • Deploy
    • Run Flower with the Deployment Engine
    • Enable TLS connections
    • Authenticate SuperNodes
    • Configure logging
    • Run Flower on Azure
    • Run Flower using Docker
      • Quickstart with Docker
      • Enable TLS for Secure Connections
      • Persist the State of the SuperLink
      • Set Environment Variables
      • Run with Root User Privileges
      • Run ServerApp or ClientApp as a Subprocess
      • Pin a Docker Image to a Specific Version
      • Use a Different Flower Version
      • Quickstart with Docker Compose
      • Run Flower Quickstart Examples with Docker Compose
      • Deploy Flower on Multiple Machines with Docker Compose

Explanations

  • Federated evaluation
  • Differential Privacy
  • Flower Architecture

References

  • Reference
    • flwr
      • client
        • start_client
        • start_numpy_client
        • Client
        • ClientApp
        • NumPyClient
        • mod
          • adaptiveclipping_mod
          • arrays_size_mod
          • fixedclipping_mod
          • make_ffn
          • message_size_mod
          • secagg_mod
          • secaggplus_mod
          • LocalDpMod
      • common
        • array_from_numpy
        • bytes_to_ndarray
        • configure
        • event
        • log
        • ndarray_to_bytes
        • ndarrays_to_parameters
        • now
        • parameters_to_ndarrays
        • Array
        • ArrayRecord
        • ClientMessage
        • Code
        • Config
        • ConfigRecord
        • ConfigsRecord
        • Context
        • DisconnectRes
        • Error
        • EvaluateIns
        • EvaluateRes
        • EventType
        • FitIns
        • FitRes
        • GetParametersIns
        • GetParametersRes
        • GetPropertiesIns
        • GetPropertiesRes
        • Message
        • MessageType
        • MessageTypeLegacy
        • Metadata
        • MetricRecord
        • Metrics
        • MetricsRecord
        • NDArray
        • NDArrays
        • Parameters
        • ParametersRecord
        • Properties
        • ReconnectIns
        • RecordDict
        • RecordSet
        • ServerMessage
        • Status
      • server
        • start_server
        • ClientManager
        • Driver
        • Grid
        • History
        • LegacyContext
        • Server
        • ServerApp
        • ServerAppComponents
        • ServerConfig
        • SimpleClientManager
        • strategy
          • Bulyan
          • DPFedAvgAdaptive
          • DPFedAvgFixed
          • DifferentialPrivacyClientSideAdaptiveClipping
          • DifferentialPrivacyClientSideFixedClipping
          • DifferentialPrivacyServerSideAdaptiveClipping
          • DifferentialPrivacyServerSideFixedClipping
          • FaultTolerantFedAvg
          • FedAdagrad
          • FedAdam
          • FedAvg
          • FedAvgAndroid
          • FedAvgM
          • FedMedian
          • FedOpt
          • FedProx
          • FedTrimmedAvg
          • FedXgbBagging
          • FedXgbCyclic
          • FedXgbNnAvg
          • FedYogi
          • Krum
          • QFedAvg
          • Strategy
        • workflow
          • DefaultWorkflow
          • SecAggPlusWorkflow
          • SecAggWorkflow
      • simulation
        • run_simulation
        • run_simulation_process
        • start_simulation
        • SimulationIoConnection
    • Flower CLI reference
    • Example projects
    • Telemetry
    • Changelog
    • Flower Network Communication
    • Exit Codes
      • [0] SUCCESS
      • [1] GRACEFUL_EXIT_SIGINT
      • [2] GRACEFUL_EXIT_SIGQUIT
      • [3] GRACEFUL_EXIT_SIGTERM
      • [100] SUPERLINK_THREAD_CRASH
      • [300] SUPERNODE_REST_ADDRESS_INVALID
      • [301] SUPERNODE_NODE_AUTH_KEYS_REQUIRED
      • [302] SUPERNODE_NODE_AUTH_KEYS_INVALID
      • [600] COMMON_ADDRESS_INVALID
      • [601] COMMON_MISSING_EXTRA_REST
      • [602] COMMON_TLS_NOT_SUPPORTED
    • FAQ

Contributor docs

  • Contribute
    • Contribute on GitHub
    • Get started as a contributor
    • Install development versions
    • Set up a virtual env
    • Develop in VSCode Dev Containers
    • Write documentation
    • Release Flower
    • Contribute translations
    • How to Build Docker Flower Images Locally
    • Public and private APIs
    • Good first contributions
    • Secure Aggregation Protocols
  • v1.8.0
  • v1.9.0
  • v1.10.0
  • v1.11.0
  • v1.11.1
  • v1.12.0
  • v1.13.0
  • v1.13.1
  • v1.14.0
  • v1.15.0
  • v1.15.1
  • v1.15.2
  • v1.16.0
  • v1.17.0
  • v1.18.0
  • main
🇬🇧 🇫🇷 🇨🇳 🇰🇷
Back to top
View this page

Persist the State of the SuperLink¶

By default, the Flower SuperLink keeps its state in-memory. When using the Docker flag --rm, the state is not persisted between container starts.

If you want to persist the state of the SuperLink on your host system, all you need to do is specify a directory where you want to save the file on your host system and a name for the database file.

By default, the SuperLink container runs with a non-root user called app with the user ID 49999. When working with Docker on Linux, it is recommended to create a new directory and set the user ID to 49999 to ensure the mounted directory has the proper permissions.

If you later want to delete the directory, you can change the user ID back to the current user ID by running sudo chown -R $USER:$(id -gn) state.

Example¶

In the example below, we create a new directory called state, change the user ID and tell Docker via the flag --volume to mount the local state directory into the /app/state directory of the container. Lastly, we use the flag --database to specify the name of the database file.

$ mkdir state
$ sudo chown -R 49999:49999 state
$ docker run --rm \
     --volume ./state/:/app/state flwr/superlink:1.18.0 \
     --database state.db \
     <additional-args>

As soon as the SuperLink starts, the file state.db is created in the state directory on your host system. If the file already exists, the SuperLink tries to restore the state from the file. To start the SuperLink with an empty database, ensure that there is no database called state.db in the state directory (rm state.db) before you execute the docker run command above.

Next
Set Environment Variables
Previous
Enable TLS for Secure Connections
Copyright © 2025 Flower Labs GmbH
Made with Sphinx and @pradyunsg's Furo
On this page
  • Persist the State of the SuperLink
    • Example