Docker enters the internal command of the container and exits
1. Enter the internal command of the container
docker exec -it 容器名称 /bin/bash //进入容器内部命令
For example: enter the command inside the nginx-test container
docker exec -it nginx-test /bin/bash //进入容器内部命令
2. Enter the nginx configuration file inside docker
cd /etc/nginx //进入nginx配置文件目录下
3. View the files/folders in the current directory
ls
4. Exit the internal command of the container
exit
I hope this article is helpful to friends who operate docker internal commands! ! !
Add one point: Generally, during the operation, we do not enter the operation inside the container. If you change the nginx configuration file nginx.conf, use the docker run command to mount it, and use docker cp to copy the nginx configuration file inside the container