Skip to main content

Agent on a Docker container

warning

Note: If you are using the shell component to access the device remotely since the agent is running inside a Docker container, you need to shell into the host to retrieve the logs. For example, if the agent is running on Spot CORE I/O with EAP2 or similar cases, please follow instructions on relate page.

This guide assumes you have direct shell access to the device running the Agent. If you need remote access, you can use the Agent Shell component, provided it is configured and enabled. Follow these instructions to activate the Shell component if needed.

Shell Tab

1. Confirm Agent is Running in a Docker Container

Identify the Agent Container: To find the container ID or name for the Agent process, use:

docker ps | grep -i rocos-agent

In some cases, you may need to have root access to run the docker command. If you are not running as root, you can use sudo to run the command.

sudo docker ps | grep -i rocos-agent

2. Retrieve Logs Using Docker Logs

Once you identify the container name (e.g., rocos_agent_container), use the following command to view logs:

sudo docker logs rocos_agent_container

3. Save Logs to a File

To save the logs to a file (e.g., agent_docker_logs.txt), redirect the output:

sudo docker logs rocos_agent_container > agent_docker_logs.txt

Depending on your docker version, you can also limit the logs time window by using --since or/and --until flags. For example:

sudo docker logs --since "24h" rocos_agent_container > agent_docker_logs_24h.txt

Please check docker logs documentation for more precise filtering options.

Alternatively, to Save Real-Time Logs: For real-time logs, use tee to write to both the console and a file:

sudo docker logs -f rocos_agent_container | tee agent_docker_realtime_logs.txt

By following these steps, you can retrieve and save logs for the Agent process whether it’s running as a systemd service or within a Docker container.

4. Zip and Download Logs

To zip and download the logs, you can use the following command:

zip agent_docker_realtime_logs.zip agent_docker_realtime_logs.txt

Then you can use the file tab to find the file and download it. Check these instructions if you need to activate the file component.