我如何进入Docker容器的shell?

走远了吗. 提交于 2020-08-06 03:15:28

问题:

I'm getting started working with Docker. 我开始使用Docker了。 I'm using the WordPress base image and docker-compose. 我正在使用WordPress基本图像和docker-compose。

I'm trying to ssh into one of the containers to inspect the files/directories that were created during the initial build. 我正在尝试ssh到其中一个容器中来检查在初始构建期间创建的文件/目录。 I tried to run docker-compose run containername ls -la , but that didn't do anything. 我试图运行docker-compose run containername ls -la ,但是没有做任何事情。 Even if it did, I'd rather have a console where I can traverse the directory structure, rather than run a single command. 即使它确实如此,我宁愿有一个控制台,我可以遍历目录结构,而不是运行单个命令。 What is the right way to do this with Docker? 使用Docker执行此操作的正确方法是什么?


解决方案:

参考一: https://stackoom.com/question/22bGv/我如何进入Docker容器的shell
参考二: https://oldbug.net/q/22bGv/How-do-I-get-into-a-Docker-container-s-shell
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!