Run the agent with Docker
Persist agent enrollment through container replacement.
Run the agent with Docker
On a Linux Docker host, save the agent configuration as agent-config.json in your current directory. Use the reachable backend URL and receiving account ID. Set Output.dataPath to /var/lib/logship-agent. This example uses host networking. Collectors see the container's filesystems and processes. For host disk and process monitoring, use the native service.
docker volume create logship-agent-state
docker run -d --name logship-agent --hostname "$(hostname)" --restart unless-stopped \
--network host \
--mount "type=bind,src=$PWD/agent-config.json,dst=/app/appsettings.json,readonly" \
--mount type=volume,src=logship-agent-state,dst=/var/lib/logship-agent \
ghcr.io/logship-io/logship-agent:latest
docker logs -f logship-agentMatch the verification ID under Settings → Account → Agents and approve. Press Ctrl+C to leave the log viewer and verify incoming records.
To check persistence, stop and remove just this container with docker stop logship-agent and docker rm logship-agent. Repeat the same run command with the same configuration, hostname and named volume. Verify fresh records and approval status in the receiving account. Keep the volume across upgrades.