从dockerfile创建的目录在哪里,如何访问它?

时间:2019-06-26 10:54:08

标签: docker

我是Docker的新手,有一个简单的问题。假设我使用以下dockerfile在mkdir文件夹中创建了一个图像:

FROM biocontainers/biocontainers:latest

USER root

RUN mkdir -p /bin/testFolder

我构建了如下图像:

docker image build -f dockerfile -t tmp:test .

消息输出如下:

Sending build context to Docker daemon  12.77GB
Step 1/3 : FROM biocontainers/biocontainers:latest
latest: Pulling from biocontainers/biocontainers
22dc81ace0ea: Pull complete
1a8b3c87dba3: Pull complete
91390a1c435a: Pull complete
07844b14977e: Pull complete
b78396653dae: Pull complete
37acb86aada8: Pull complete
dea6dd7e30dd: Pull complete
5f8154b871f1: Pull complete
06b022b2c83f: Pull complete
9b2c8a4ecb8d: Pull complete
7b30ef549338: Pull complete
9b34fc643fc1: Pull complete
52c0fab077ab: Pull complete
db8c4567241d: Pull complete
db7cd43b1320: Pull complete
c0db2ee4b7f4: Pull complete
Digest: sha256:c6f082f5658c6d31a5ccb537289d1ce777f51b7285c465fe0efa219058471c81
Status: Downloaded newer image for biocontainers/biocontainers:latest
 ---> 932119eee190
Step 2/3 : USER root
 ---> Running in a707d5e1b39d
Removing intermediate container a707d5e1b39d
 ---> a1c02b8e9ed3
Step 3/3 : RUN mkdir -p /bin/testFolder
 ---> Running in 88f453470cc6
Removing intermediate container 88f453470cc6
 ---> 12d57c57c415
Successfully built 12d57c57c415
Successfully tagged tmp:test

我如何知道/bin/testFolder的位置以及如何访问它?谢谢。

1 个答案:

答案 0 :(得分:2)

到目前为止,您已经构建了映像。下一步是使用docker run -d --name container-name image-name运行容器,例如docker run -d --name myfirstcontainer tmp:test

该目录位于容器内。您可以使用docker exec -it myfirstcontainer bash

输入容器