Module Repository - DockerHub
This document describes how to publish modules to DockerHub, so they could be later accessible to weeve system.
In this document we will describe the publishing process to module repository. Currently, weeve supports Docker system and all modules that are used by weeve are stored in DockerHub. Hence, new developers and their modules will need to be published to DockerHub. You can store the main code of your module wherever you want, i.e. in GitHub or GitLab, or on your local machine, as long as the module image is published to DockerHub in the end. You can think of DockerHub as a repository storing Docker images that are accessible to other developers.
As described in our Hello Weeve tutorial, once your code for the module is running and working correctly, it should be published to DockerHub, so that it was accessible by weeve system.
Docker has a lot of excellent documentation on publishing Docker images, so please refer there (we also briefly describe this process in Hello Weeve tutorial):
- Docker Hub for Teams and Organizations - for developers who are part of a bigger organization, i.e. a company.
Before you continue, we recommend reading our documentation on Module and Docker Images naming, and use of Docker tags.
You will need a Docker account that you can access from the command line and log in with the docker login command. If you do not feel comfortable with having your own DockerHub repository, you can always reach out to us and ask for storing your modules in our repos.
The entire process could be shortly described in two steps:
1. Build Image
Firstly, we need to build the module image that we want to publish. You can either build a module image that will run only on a machines of architecture similar to your local machine, or you can build for multiple multiple architectures/platforms. Since, sometimes modules will need to run on various devices, we recommend the latter approach.
- docker build - this command will build the module image that will run on device architectures similar to your local machine, i.e. if you build image on your personal computer then this module image will run only on amd64 architectures. You can use this command as follows:
docker build -t <module_name>:<tag> . -f <PATH/Dockerfile>
docker build -t weevenetwork/python-processing-module-boilerplate . -f image/Dockerfile
- docker buildx - this command allows you to choose what type of architecture you want your module to support. This is an approach that we recommend. You can use this command as follows:
docker buildx build --platform <architecture_1,architecture_2,architecture_3,...> -t <module_name>:<tag> --push . -f <PATH/Dockerfile>
NOTICE: this command also includes flag
--push
at the end, to automatically push all created images to DockerHub repository, then step 2. could be omitted.For instance, in our Modules Boilerplates
makefiles
you can find the following line that builds docker image for architectures linux/amd64, linux/arm and linux/arm64 :docker buildx build --platform linux/amd64,linux/arm,linux/arm64 -t weevenetwork/python-processing-module-boilerplate --push . -f image/Dockerfile
2. Push Image
Secondly, to publish a Docker image to the repository, you need to push it to DockerHub. This can be done with command docker push as follows:
docker image push <module_name>:<tag>
docker image push weevenetwork/python-processing-module-boilerplate
Finally, you can log in to your repository on DockerHub website and check if the images were published successfully.
Last modified 7mo ago