[英]Using docker with running process
I've created this docker file which works for 我已经创建了适用于
FROM debian:9
ENV CF_CLI_VERSION "6.21.1"
# Install prerequisites
RUN ln -s /lib/ /lib64
RUN apt-get update && apt-get install curl -y
RUN curl -L "https://cli.run.pivotal.io/stable?release=linux64-binary&version=${CF_CLI_VERSION}" | tar -zx -C /usr/local/bin
And it works as expected, now I run it like following 它可以按预期运行,现在我像下面那样运行
docker run -i -t cf-cli cf -v
and I see the version 我看到了版本
Now every command which I want to run is something like 现在我要运行的每个命令都类似
docker run -i -t cf-cli cf -something
my question is how can I enter into container and do ls etc without every-time doing 我的问题是我怎么能不每次都进入容器并做ls等
docker run -i -t cf-cli
... docker run -i -t cf-cli
...
I want to enter to the container like you enter to machine. 我想像进入机器一样进入容器。
Have a look at docker exec . 看看docker exec 。 You'll probably want something like
docker exec -it containername bash
depending on the shell installed in the container. 您可能需要类似
docker exec -it containername bash
类的东西,具体取决于docker exec -it containername bash
安装的外壳。
如果我正确理解你只需要
docker exec -it <runningcontainername> bash
Step 1: 第1步:
Run the container in background: 在后台运行容器:
docke run -d --name myapp dockerimage
Step2: 第2步:
Exec into the containr myapp: 执行到容器myapp中:
docker exec -it myapp bash
run any commands inside as u wish 如你所愿运行任何命令
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.