Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
命令docker运行创建空容器_Docker_Containers - Fatal编程技术网

命令docker运行创建空容器

命令docker运行创建空容器,docker,containers,Docker,Containers,命令docker run创建空容器。我的意思是docker映像构建成功,但当我运行容器时,并没有我的更改。我正在用vagrant开发ubuntu 16.04。我的docker文件: FROM node:6.2.0-wheezy MAINTAINER Lukasz Migut RUN mkdir -p /app ADD package.json /app/package.json RUN cd /app/ && \ npm cache clear && \

命令
docker run
创建空容器。我的意思是docker映像构建成功,但当我运行容器时,并没有我的更改。我正在用vagrant开发ubuntu 16.04。我的docker文件:

FROM node:6.2.0-wheezy

MAINTAINER Lukasz Migut

RUN mkdir -p /app

ADD package.json /app/package.json

RUN cd /app/ && \
npm cache clear && \
npm install --no-bin-links --quiet

RUN mkdir -p /var/www/backend

WORKDIR /var/www/backend

COPY entrypoint.sh /entrypoint.sh

CMD ["/bin/bash", "/entrypoint.sh"]

EXPOSE 8080
这是docker构建后的输出。

Sending build context to Docker daemon 6.144 kB
Step 1 : FROM node:6.2.0-wheezy
6.2.0-wheezy: Pulling from library/node
47994b92ab73: Already exists 
a3ed95caeb02: Already exists 
9b7b75987c3c: Already exists 
d66c4af59bfb: Already exists 
26df7d6a7371: Already exists 
b656b9b4e7eb: Already exists 
e3753c84bc68: Already exists 
Digest:       sha256:9a04df0cd52487e2fb6d6316890380780209f9211f4767934c5f80f2da83a6bf
Status: Downloaded newer image for node:6.2.0-wheezy
---> ecbd08787958
Step 2 : MAINTAINER Lukasz Migut
---> Running in 2a1d31015aea
---> 6d6ff7769ec5
Removing intermediate container 2a1d31015aea
Step 3 : ADD package.json /app/package.json
---> 5a28cc87577c
Removing intermediate container 3df429908e6c
Step 4 : RUN cd /app/ &&     npm cache clear &&     npm install --no-    bin-links --quiet
---> Running in 1fc442eb449a
npm info it worked if it ends with ok
npm info using npm@3.8.9
npm info using node@v6.2.0
npm info ok 
blog-backend@0.0.1 /app
`-- hapi@13.4.1 
+-- accept@2.1.1 
+-- ammo@2.0.1 
+-- boom@3.2.0 
+-- call@3.0.1 
+-- catbox@7.1.1 
+-- catbox-memory@2.0.2 
+-- cryptiles@3.0.1 
+-- heavy@4.0.1 
+-- hoek@4.0.0 
+-- iron@4.0.1 
+-- items@2.1.0 
+-- joi@8.1.0 
| +-- isemail@2.1.2 
| `-- moment@2.13.0 
+-- kilt@2.0.1 
+-- mimos@3.0.1 
| `-- mime-db@1.23.0 
+-- peekaboo@2.0.1 
+-- shot@3.0.1 
+-- statehood@4.0.1 
+-- subtext@4.0.3 
| +-- content@3.0.1 
| +-- pez@2.1.1 
| | +-- b64@3.0.1 
| | `-- nigel@2.0.1 
| |   `-- vise@2.0.1 
| `-- wreck@7.2.1 
`-- topo@2.0.1 

---> ad5bf17db156
Removing intermediate container 1fc442eb449a
Step 5 : WORKDIR /var/www/backend
---> Running in 3f75e64f3880
---> 477162d999c0
Removing intermediate container 3f75e64f3880
Step 6 : COPY entrypoint.sh /entrypoint.sh
---> b0918e5611e2
Removing intermediate container b1c46f9175dd
Step 7 : CMD /bin/bash /entrypoint.sh
---> Running in fd2c72465c11
---> 275911ac22ca
Removing intermediate container fd2c72465c11
Step 8 : EXPOSE 8080
---> Running in d54c25afb6a1
---> f4ba799427cc
Removing intermediate container d54c25afb6a1
Successfully built f4ba799427cc
命令
docker图像

REPOSITORY          TAG                 IMAGE ID            CREATED               SIZE
<none>              <none>              f4ba799427cc        28 minutes  ago      514.2 MB
node                6.2.0-wheezy        ecbd08787958        8 days ago           503.9 MB
创建的存储库标记图像ID大小
f4ba799427cc 28分钟前514.2 MB
节点6.2.0-喘息ecbd08787958 8天前503.9 MB
接下来,我尝试使用
dockerrun-it节点运行容器:6.2.0-wheezy/bin/bash
当我登录到容器时,我看不到例如从Dockerfile创建的文件夹和没有节点的模块


我做错了什么,为什么我看不到更改?

您创建了一个映像。。。它是docker images命令中标记为“”的。但是,当您尝试运行容器时,使用了基于新映像的旧映像。你的改变在新的图像中,而不是旧的图像中

要让它工作,你必须用一个名字标记你的新图像,并使用这个名字

docker build -t MYIMAGENAME .
docker run -it MYIMAGENAME /bin/bash

你建立了一个形象。。。它是docker images命令中标记为“”的。但是,当您尝试运行容器时,使用了基于新映像的旧映像。你的改变在新的图像中,而不是旧的图像中

要让它工作,你必须用一个名字标记你的新图像,并使用这个名字

docker build -t MYIMAGENAME .
docker run -it MYIMAGENAME /bin/bash