Working with Docker images
Docker images run in Docker containers. Confusing? maybe, but we try to use the right words in this article.
Code on numerous runs in Docker containers. This makes numerous a very flexible platform for creating and running your tools. There are virtually no limits on what you can run in containers on numerous as long as you can build the images and of course abide by our Terms of Service.
Working with containers can be complex. Numerous has features to help you and this guide will show you how.
Repository Files
To run your code on numerous you must specify a Dockerfile. The Dockerfile specifies how your project is built. Together with the Dockerfile, we propose that your project contain:
File | Description |
---|---|
Dockerfile | See below. |
.gitignore | We propose you add these to your .gitignore: tmp/ , .exclude and .numerous.repository.json . These files are used by the numerous CLI. |
requirements.txt | Add your python requirements here. Remember to add numerous.sdk . |
python_code.py | Your python code. You can work in any language you like, but our SDK is for the moment only in python. |
Content of the Dockerfile
Here is an example of a simple Dockerfile, that will work with numeorus. The example is taken from the getting started example:
FROM python:3.10-slim
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . /app
WORKDIR /app
ENTRYPOINT ["python", "python_code.py"]
How images are build
There are 3 ways to get your code running on numerous:
- (Recommended) You can connect your Gitlab projects directly to numerous and build your images by selecting a commit. See more about Repositories on numerous.
- You can push and build your code with the CLI. See more here.
- You can build your Docker image on your own machine and use it directly on numerous. See more about that option below.
Setting the image path under tools
You control what image is used for the code that runs under scenarios. You can set the image path under the run settings on the scenario or you can set the image path directly when configuring the tool job.
Setting the image path under tool jobs gives you control over what image is run when creating the tool, but the image path on the scenario takes precedent. So if the image path is changed on the scenario, then it is that image that will run when pressing play.
When your image is build by using the CLI, you can copy the image path from the scenario to the tool or just copy it and save it for later. The image remains on our servers.
Bring your own containers to numerous
When building your own Docker images you need to host them somewhere in order to be able to add them to numerous.
You need to host the images on a publicly available URL address. Remember to use the public URL and not the file path when adding the image path to numerous.