About Docker Images Within Saagie
This documentation assumes a basic understanding of Docker, including how to create a Docker image. For more information about Docker basics, check out the Docker’s official documentation. |
How Does Saagie Use Docker Images?
Once a Saagie job or app is done, whether it succeeds or fails, it will not be relaunched.
There are some key differences between Saagie jobs and apps:
-
Jobs work with the command line and packages.
-
Apps expose ports and mount volumes, then share that information with all instances of the app.
Launching Saagie Jobs and Apps
When a Saagie job or app is launched, the following elements are added to the Docker image:
-
Environment variables, previously determined in the project or platform.
-
Configuration files mounted to standard paths, includes data lake configuration files and how tools, such as Kerberos, are configured.
A Saagie job also adds the following to the Docker image:
-
If the chosen technology requires a package, such as a
.zip
,.py
, or.jar
, it will be mounted in the job.-
Packages are uploaded when a job is configured.
-
Saagie will replace
{file}
with the package absolute path in the command line from the job configuration process. -
The package is unaltered, for example, it is not decompressed or renamed.
-
-
The command line is saved in the file
main_script
and mounted as executable on the path/sandbox/main_script
.-
The ENTRYPOINT of your Docker image must run this file if you have the
COMMAND_LINE
feature. This is discussed in more detail in the next section, How to Create Docker Images Compatible With Saagie?
-
A Saagie app also adds the following to the Docker image:
-
Mounted directories corresponding to the volume selected when creating the job.
How to Create Docker Images Compatible With Saagie?
In order for your Docker images to be compatible with Saagie, consider the information below.
For Jobs
When using the COMMAND_LINE
feature, use a Dockerfile to create a new Docker image.
The Dockerfiles used by Saagie to create our Docker images are the following:
COPY entrypoint /entrypoint RUN chmod 755 /entrypoint WORKDIR /sandbox ENTRYPOINT ["bash","/entrypoint"]
#!/bin/bash
set -euo pipefail
if test -f /sandbox/main_script;
then sh /sandbox/main_script;
fi;
The command line is saved in the file /sandbox/main_script
.
The ENTRYPOINT for the Docker image will run the bash script entrypoint
, which verifies that the /sandbox/main_script
file exists.
The Docker image will launch the file and, as a result, run the command line entered by the user.
For more examples of how Saagie uses Docker images, see the Saagie repository for official job examples. |
Useful Links
-
See the official Docker documentation to learn how to write a good Dockerfile:
-
Best Practices for Writing Dockerfiles (Docker documentation)
-
Intro Guide to Dockerfile Best Practices (Docker blog post)
-
-
See the Container Structure Tests on Git to confirm the compatibility and quality of your Docker images.