Troubleshoot Docker Monitoring
Diagnose why SwiftServer cannot read Docker status, with fixes for permissions, Docker version issues, and support diagnostics.
Why Docker Monitoring Fails
SwiftServer reads Docker status by directly running Docker CLI commands on your server, such as:
docker ps
docker image ls
docker compose lsBecause of that, Docker monitoring usually fails for one of these reasons:
- The current user does not have permission to run
dockerwithoutsudo - Docker is too old
- The server only has the legacy
docker-composecommand instead of the newerdocker composecommand
In most cases, the issue is the first one: permissions.
1. Check Docker Permissions First
On many Linux servers, the root user can run Docker commands directly, but a non-root user often needs:
sudo docker psThis causes a problem for SwiftServer, because SwiftServer runs docker directly and does not prepend sudo automatically. If your user can only use Docker through sudo, SwiftServer may fail to read Docker status.
According to Docker's official post-installation recommendation, the usual fix is to add your user to the docker group:
Reference: Linux post-installation steps for Docker Engine
If your username is ubuntu, run:
sudo usermod -aG docker ubuntuAfter that:
- Log out and log back in, or run
newgrp dockerso the new group membership takes effect - Restart SwiftServer
- Test whether your user can run Docker commands without
sudo
For example:
docker ps
docker image lsIf these commands work without sudo, SwiftServer will usually be able to read Docker status correctly.
2. Update Docker and Use the Correct Compose Command
Another common cause is an outdated Docker installation.
Please upgrade Docker to a recent version. SwiftServer supports the modern Compose plugin command:
docker composeSwiftServer does not support the legacy standalone command:
docker-composeIf your server only has docker-compose but not docker compose, Docker monitoring and Compose-related status collection may not work correctly.
3. Collect Diagnostic Information
If the permission fix and Docker upgrade still do not solve the problem, run the following five commands in your Linux terminal.
Before sending the output to support, please remove any sensitive information yourself.
Command 1
command -v docker >/dev/null 2>&1 && (dockerinfo=$(docker info --format '{{.ServerVersion}},{{.Containers}},{{.ContainersRunning}},{{.ContainersStopped}},{{.Images}}') && echo "$dockerinfo") || echo 'Docker not installed'Command 2
command -v docker >/dev/null 2>&1 && (dockerstats=$(docker stats --no-stream --format '{{ json . }}') && dockerps=$(docker ps --format '{{.ID}},{{.Status}}') && dockerls=$(docker container ls -a --no-trunc --format '{{ json . }}') && echo "$dockerstats,|,$dockerps,|,$dockerls") || echo 'Docker not installed'Command 3
docker compose version >/dev/null 2>&1 && (composers=$(docker compose ls -a --format json) && containers=$(docker compose ls -a -q | xargs -r -I{} docker compose -p {} ps -a --format '{},{{.ID}}') && echo "$composers|$containers") || echo 'Docker Compose not installed'Command 4
command -v docker >/dev/null 2>&1 && (docker image ls -a --format '{{ json . }}') || echo 'Docker not installed'Command 5
command -v docker >/dev/null 2>&1 && (docker volume ls --format '{{ json . }}') || echo 'Docker not installed'4. Contact Support
After collecting the results of the five commands above, send them to:
Please include:
- The command output after removing sensitive information
- Whether your server user can run
dockerwithoutsudo - Whether
docker composeworks on your server - Your Docker version
With that information, we can help diagnose why Docker monitoring is not working on your server.