In Docker, you should use pm2-runtime instead of pm2. pm2-runtime runs the server in the foreground and correctly handles log streams (stdout and stderr).

pm2-runtime start index.js --name="API"

You can collect PM2 logs by running the Atatus agent as a sidecar container.