The first step to getting your code to run on a provider node is preparing a Docker image. This image will define the virtual machine in which your logic is going to be executed by provider nodes.
The below diagram depicts a simplified flow of interaction between the requestor agent and images running in runtimes on providers:
Let's start with the definition for our image. We're going to use the following
FROM debian:latestVOLUME /golem/input /golem/outputWORKDIR /golem/work
FROM command specifies what existing image we want to use as our base. In this case we're using Debian Linux in its version tagged as
latest. You can search for existing images using the Docker Hub.
The next line uses a single
VOLUME command to define two volumes:
When a Golem virtual machine is started, for each volume defined there will be a new directory created in the host's file system. This directory will then be made available inside the VM under it's specified path (for example
Finally, we specify a working directory. This will be the default directory to be used in shell commands once the VM is running.
Having the above
Dockerfile we can now build an image based on that file. To do so, we're going to use Docker's
docker build -t golem-example .
The above command assigns the tag
golem-example to its output image. Once it's finished we should see the message
Successfully tagged golem-example:latest in the terminal's output.
To verify the image is created we can list all images available locally by running:
We've just built our custom Docker image, nice! The next step is to convert this image to a format the Docker VM runtime can handle.