Vincent Chéry
07/04/2025, 12:58 PMjob_variables
argument of the .to_deployment
method. Can you show me the correct syntax ?Marvin
07/04/2025, 12:58 PMMarvin
07/04/2025, 1:01 PMjob_variables
parameter when creating your deployment. Here's how to do it:
python
flow.to_deployment(
name="your-deployment-name",
job_variables={
"docker_run_config": {
"group_add": [800]
}
}
)
This configuration will be passed to the Docker container when it runs. The group_add
parameter corresponds to Docker's --group-add
flag, which adds the container process to the supplementary group ID 800.
Alternatively, if you're using a more detailed Docker configuration, you could also specify it this way:
python
flow.to_deployment(
name="your-deployment-name",
job_variables={
"docker": {
"run_config": {
"group_add": [800]
}
}
}
)
Both approaches should achieve the same result, adding your container process to the specified group ID.
Note that for this to work:
1. The group ID 800 must exist in the container
2. Your container must have the necessary permissions to add groups
3. This setting will only affect the container runtime environment, not the host system
If you need to create the group inside the container as well, you would need to handle that in your Dockerfile with something like RUN groupadd -g 800 mygroup
.
For more information about customizing deployment job variables, you can refer to the Prefect documentation on customizing job variables.