Lifecycle - Docker mode
The lifecycle of a Ponos agent in Docker mode is similar to that of the generic Ponos agent. Only the actions specific to task management differ.
Setup
In addition to the generic Ponos agent setup, the Ponos agent in Docker mode will:
-
Authenticate to Docker registries (using the
docker.registriesparameter of its configuration). -
Log information about the host’s system (using the
docker.fake_gpusparameter of its configuration). -
List the tasks running on the host. The agent will list all Docker containers. For each Docker container, the agent will:
-
Retrieve the task’s ID related to the Docker container using the container’s environments (which is of the form
PONOS_TASK=<task_id>). -
Retrieve the task’s details (using the
RetrieveTaskDefinitionendpoint). If the task no longer exists or is assigned to another agent, the Docker container is ignored. -
Add the task to the list of running tasks.
-
Loop
For its loop, the Ponos agent in Docker mode uses the same lifecycle as the generic Ponos agent. But to know if the agent is ready, it will check the Docker socket. However, there are some specific points to note when the agent checks the running tasks:
-
To retrieve the task’s logs, the agent uses the logs related to the Docker container.
-
To find out the exit code, the agent retrieves the status code of the Docker container.
Start task
For a Ponos agent in Docker mode, starting a task means:
-
Download or pull the Docker image of the task (using the
docker.check_local_cacheparameter of its configuration). -
Start the task in a Docker container (using the
docker.shared_process_volume,docker.volumes,docker.networkanddocker.dnsparameters of its configuration).
Stop task
For a Ponos agent in Docker mode, stopping a task means:
-
Delete the Docker container related to the task.