Last updated about 2 months ago
Koyeb natively allows you to run your own, pre-built containers. With containers, you can embed all the system dependencies you need.
This is actually what we did in the Your first Stack guide. This time we will use a raw Docker image to experiment.
This example will executein an Docker container each time the Koyeb Function is invoked. The is a Koyeb generated file, which is always present in your containers and contains data about the event that triggered the execution in format.
Our example will display the content of the event received by the container on stdout, which is readable in the logs.
1functions: 2 - name: "hello-container" # The function name 3 image: ubuntu # The Docker image to use 4 command: ["cat"] # Overrides the container default command 5 args: ["/koyeb/events/in/raw"] # The arguments of the command 6
Theoption of the YAML file allows you to override the default command specified with in the Dockerfile of the container.
Theoption allows you to provide arguments to the default of the Dockerfile or the you provided.
Now, you can Invoke your function with the pre-filledevent data.
In your log files, you should see a JSON similar to:
1docker run 2
At the moment, we only support the official public Docker registry, but support for private registries is on the way! If you are interested in support for private registries, please do not hesitate to contact us about your needs.