宿主机的服务慢查询是正常的,但是到了Docker中的php-fpm服务,触发慢查询后,会输出类似报错:

[31-May-2019 09:48:13] ERROR: failed to ptrace(ATTACH) child 5118: Operation not permitted (1)
[31-May-2019 09:48:13] WARNING: [pool www] child 5118, script '/www/index.php' (request: "GET /index.php") executing too slow (1.021099 sec), logging

开始没想到的Docker容器权限问题,后来搜了下,在serverfault找到了解决方案:
容器启动时,加入参数:

--cap-add SYS_PTRACE

解决方案来自:https://serverfault.com/questions/704007/php-slowlog-causing-ptrace-error-in-docker-container/706982#706982

Related Posts: Docker php-fpm 慢查询 failed to ptrace Operation not permitted解决方案 :

avatar