Solutions · Containers
mi-app: its process runs as root
With example names (mi-app, /ruta/al/proyecto). In GoTool, in 🛡 Security, this page shows your project's: your container, your compose file, your WordPress folder.
What's happening
The main process of container mi-app is root (docker top says so, not just the image mi-imagen:1.0).
Why it matters
If someone gets in through the application, they're root inside the container; and with a bug in the engine, or one volume or capability too many, they're root on your machine.
What to do
- In the compose file (/ruta/al/proyecto/compose.yaml), in service app, make it start with a user that isn't root:
user: "1001:1001" - Recreate it with the change (whatever isn't in a volume is lost: that's the point):
docker compose -f /ruta/al/proyecto/compose.yaml up -d --force-recreate app
How to know it's fixed
- The USER column no longer says root:
docker top mi-app -o user,pid,cmd - gotool checks your Docker again on its next pass: once it's gone, it stops showing up.
If you can't do it that way
- Without touching the image: user: "1001:1001" in the compose file (or --user 1001:1001). Check that it starts: some images need to write where only root can.
- If it has to start as root (to open port 80, for example), have its process drop to another user, as nginx or mysql do, and preferably use a port above 1024.
- For the whole engine: Docker in rootless mode or rootless Podman. A container that escapes isn't root on the machine.
More
In GoTool, the file with the issue (the Dockerfile, the compose file) is also shown with the solution next to it, and the question for Claude comes ready, with your project's details and without your keys, to paste into your claude.ai.