How to Build Docker Flower Images Locally¶
Flower는 ‘Docker Hub <https://hub.docker.com/u/flwr>’_에서 미리 만들어진 Docker 이미지들을 제공합니다. 해당 이미지들은 SuperLink, ServerNode 또는 ServerApp을 실행하는 데 필요한 모든 dependencies를 포함합니다. 필요한 경우 다른 버전의 Python이나 Linux 배포판(Ubuntu/Alpine)을 사용해 처음부터 사용자 정의 Docker 이미지를 빌드할 수도 있습니다. 이 가이드에서는 존재하는 이미지들과 이들을 로컬에서 빌드하는 방법에 대해 설명하겠습니다.
시작하기 전에, 로컬 개발 환경에서 몇 가지 전제 조건을 충족해야 합니다.
Clone the
flowerrepository.$ git clone --depth=1 https://github.com/adap/flower.git && cd flower
Docker 데몬이 실행 중인지 확인하십시오.
The build instructions that assemble the images are located in the respective Dockerfiles. You can find them in the subdirectories of
framework/docker.Flower Docker는 빌드 전달인자를 통해 구성됩니다. 빌드 argument들을 통해, 이미지를 보다 유연하게 생성할 수 있습니다. 예를 들어, base 이미지에서 “PYTHON_VERSION” 빌드 전달인자를 사용하여 Python 버전을 지정할 수 있습니다. 일부 빌드 전달인자들은 기본값이며, 이미지를 빌드할 때 지정해야 합니다. 각 이미지에 사용할 수 있는 모든 빌드 전달인자는 아래 표 중에 있습니다.
Building the Base Image¶
빌드 전달인자 |
설명 |
필수 |
예시 |
|---|---|---|---|
|
기본 이미지 사용을 위한 Linux 배포판. |
아니오 |
|
|
Linux 배포판 버전. |
아니오 |
|
|
설치 된 |
아니오 |
|
|
설치 된 |
예 |
|
|
설치 된 |
예 |
|
|
설치 된 Flower 버전. |
예 |
|
|
설치 할 Flower 패키지. |
아니오 |
|
|
A direct reference
without the |
아니오 |
The following example creates a base Ubuntu/Alpine image with Python 3.11.0, pip
24.1.2, setuptools 70.3.0
and Flower 1.23.0:
$ cd framework/docker/base/<ubuntu|alpine>
$ docker build \
--build-arg PYTHON_VERSION=3.11.0 \
--build-arg FLWR_VERSION=1.23.0 \
--build-arg PIP_VERSION=24.1.2 \
--build-arg SETUPTOOLS_VERSION=70.3.0 \
-t flwr_base:0.1.0 .
In this example, we specify our image name as flwr_base and the tag as 0.1.0.
Remember that the build arguments as well as the name and tag can be adapted to your
needs. These values serve as examples only.
Building a Flower Binary Image¶
빌드 전달인자 |
설명 |
필수 |
예시 |
|---|---|---|---|
|
기본 이미지의 레포지토리 이름. |
아니오 |
|
|
Flower 기본 이미지의 태그. |
예 |
|
For example, to build a SuperLink image with the latest Flower version, Python 3.11 and Ubuntu 22.04, run the following:
$ cd framework/docker/superlink
$ docker build \
--build-arg BASE_IMAGE=1.23.0-py3.11-ubuntu22.04 \
-t flwr_superlink:0.1.0 .
If you want to use your own base image instead of the official Flower base image, all
you need to do is set the BASE_REPOSITORY build argument to flwr_base (as we’ve
specified above).
$ cd framework/docker/superlink/
$ docker build \
--build-arg BASE_REPOSITORY=flwr_base \
--build-arg BASE_IMAGE=0.1.0
-t flwr_superlink:0.1.0 .
이미지 생성 후에, 이미지가 작동하는지 테스트할 수 있습니다:
$ docker run --rm flwr_superlink:0.1.0 --help
Direct Reference Examples¶
# main branch
git+https://github.com/adap/flower.git@main#subdirectory=framework
# commit hash
git+https://github.com/adap/flower.git@4bc1bca3d0576dd2233972d9d91c2c7e8eb03edd#subdirectory=framework
# tag
git+https://github.com/adap/flower.git@1.23.0#subdirectory=framework
# artifact store
https://artifact.flower.ai/py/main/latest/flwr-1.23.0-py3-none-any.whl