Share this post
![](/static/images/previews/1200x628/2024-06-20-announcing-flower-docker.jpg)
We are excited to announce the release of our new Flower Docker images: SuperLink, SuperNode, and ServerApp.
These images have replaced our current Server and Client Docker images, bringing significant improvements in size, security, and enabling anyone to deploy Flower end-to-end using Docker in a production environment.
In this blog post, we will explore the features and benefits of these new images and how to use them.
What's new?
Introducing SuperLink, SuperNode, and ServerApp
To align with the naming in Flower Next, we created new Docker repositories to host our new images. The SuperLink Docker image is now replacing our former Server Docker image, while the SuperNode is taking the place of our previous Client image.
Non-Root Containers
All three images run with a non-root user by default, enhancing security by restricting container privileges and reducing potential risks.
Size Reduction
We made significant progress in reducing the size of our Docker images, with the new images being up to 80% smaller than their predecessors. This size reduction not only speeds up deployment times but also minimizes storage requirements.
Alpine Support for SuperLink
In addition to the improvements in size, we have added Alpine support for the SuperLink image. Alpine Linux is a lightweight and secure Linux distribution, making it perfect for production environments.
Security Enhancements
We have worked hard to significantly reduce the number of security vulnerabilities in our new Docker images. By using multi-stage builds and updating all fixable packages, we have made our images more secure for your Flower deployments.
Nightly Releases
To ensure you always have access to the latest updates and improvements, we now offer nightly releases for all three new images. These nightly builds are ideal for anyone who wants to test the cutting-edge features of Flower.
Deprecation of Server and Client Images
Please note that we have deprecated the Server and Client images. We encourage anyone to migrate to the new SuperLink and SuperNode images as soon as possible to take advantage of the enhanced features and performance they offer. We have included a guide at the end this blog post to assist you with transitioning to the new images.
Now, let's see how to use these new Docker images with a demo.
Demo
For our demo, we have chosen the quickstart-pytorch example, which you can find here.
To keep things concise, we will not delve too deeply into the code for the ClientApp and ServerApp, but instead focus on the Dockerfiles needed to containerize them.
Additionally, we will utilize Docker Compose to start all the containers with a single command, eliminating the need to start each container in a separate terminal. All files that we will create must be in the same directory.
Dockerfile.supernode
First, we begin by containerizing the ClientApp. We create a new Dockerfile named Dockerfile.supernode and add the following code:
FROM flwr/supernode:1.9.0
WORKDIR /app
RUN python -m pip install -U --no-cache-dir \
"flwr-datasets[vision]>=0.1.0,<1.0.0" \
torch==2.2.1 \
torchvision==0.17.1 \
tqdm==4.66.3
ADD --chown=app https://raw.githubusercontent.com/adap/flower/v1.9.0/examples/quickstart-pytorch/client.py ./
ENTRYPOINT ["flower-client-app", "client:app"]
On top of the flwr/supernode base image, we install the necessary dependencies for this demo, like PyTorch and Flower Datasets. Next, we download the ClientApp code from the Flower repository using the ADD instruction in the Dockerfile. Finally, we call the flower-client-app binary with the object reference of the ClientApp as a parameter.
Dockerfile.serverapp
Moving on to our ServerApp, we follow a similar process. We create a new Dockerfile called Dockerfile.serverapp add the following code:
FROM flwr/serverapp:1.9.0
WORKDIR /app
ADD --chown=app https://raw.githubusercontent.com/adap/flower/v1.9.0/examples/quickstart-pytorch/server.py ./
ENTRYPOINT ["flower-server-app", "server:app"]
Here, we use the flwr/serverapp image, download the ServerApp code from the Flower repository, and launch the application by calling the flower-server-app binary with the object reference of the ServerApp.
compose.yaml
To make it all work together seamlessly, we create a Docker Compose file called compose.yaml with the following content:
services:
# create a SuperLink service
superlink:
image: docker.io/flwr/superlink:1.9.0
command: "--insecure"
# create a SuperNode service with two containers
supernode:
build:
dockerfile: Dockerfile.supernode
deploy:
replicas: 2
command: ["--insecure", "--superlink", "superlink:9092"]
depends_on:
- superlink
# create a ServerApp service
serverapp:
build:
dockerfile: Dockerfile.serverapp
command: ["--insecure", "--superlink", "superlink:9091"]
depends_on:
- superlink
- supernode
We have now created all the necessary files. To start all containers, run the command in the directory where the files are located:
docker compose up --build
![](/static/images/blog/content/2024-06-20-announcing-flower-docker.gif)
That's all it takes to run Flower end-to-end in Docker.
Note
This demo utilizes insecure channels for ease of setup. It is not recommended to use insecure channels in production environments. For more information, see our Docker documentation, which provides detailed information on how to set up secure channel configurations.
Conclusion
The new Flower Docker images represent an important step forward in providing significant improvements in performance, security, and flexibility. With non-root container support, reduced image sizes, and Alpine support these new images are the perfect choice for your Flower deployments.
We will continue to optimize our Docker images to make them even better. If you have questions, ideas, or feedback, please reach out to us on Flower Discuss, Slack, or GitHub.
Don't wait - start using the new Flower Docker images today!
Migration Guide
Server Image
To migrate the flwr/server image, simply update your existing Docker commands to use the flwr/superlink:1.9.0 image instead.
If you're using secure channels, make sure to update the certificates flag from:
to:
Client Image
In the past, we released a client image for Flower, but it was never publicly announced. If you've been using this image, try to replace it with the flwr/supernode:1.9.0 image. If you encounter any issues during the migration process, don't hesitate to reach out to us on Flower Discuss, Slack, or GitHub.
Share this post