[英]Access running docker container filesystem
I am developing a WordPress theme and set up the development environment using docker.我正在开发 WordPress 主题并使用 docker 设置开发环境。 My docker-compose.yml volume property looks like this;
我的 docker-compose.yml 卷属性如下所示;
volumes:
- ~/WordPress/wp-content:/var/www/html/wp-content
it mounts just the wp-content directory to the local machine.它只将 wp-content 目录挂载到本地机器上。 I now have to edit wp-config file which is in /var/www/html/ the docker image container.
我现在必须编辑 /var/www/html/ docker 图像容器中的 wp-config 文件。 Can anyone here show me how to access and edit the wp-config file in the running docker container?
这里有人能告诉我如何访问和编辑正在运行的 docker 容器中的 wp-config 文件吗?
You can run a shell terminal in the running container.您可以在正在运行的容器中运行 shell 终端。
Get the container ID获取容器 ID
docker container ls
Run the terminal运行终端
docker container exec -it container_ID "/bin/bash"
But, whatever change you do, it will not be persisted.但是,无论你做什么改变,它都不会持久化。 You have to map this volume also.
您还必须映射此卷。
volumes:
- ~/WordPress/wp-content:/var/www/html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.