一般容器会指定非root用户运行应用,当需要使用特权测试时,可指定参数 --user root 进入容器
# exec方式在退出的时候不会将容器服务关闭docker exec -it --user root container_id /bin/bash