一、以root权限进入容器 sudo docker exec -ti -u root 容器id /bin/bash 二、安装apt-get 依次执行 apt-get update apt-get install -y vim 三、进入要编辑的目录 vim /etc/nginx/nginx.conf