命令docker run创建空容器

时间:2016-06-02 16:38:59

标签: docker containers

命令docker run创建空容器。我的意思是docker图像构建成功但是当我运行容器时没有我的更改。我正在与流浪汉合作开发ubuntu 16.04。我的泊坞文件:

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 build .

之后的输出
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 images

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

接下来我尝试使用docker run -it node:6.2.0-wheezy /bin/bash 运行容器 当我登录容器时,我无法看到例如Dockerfile创建的文件夹,也没有node_modules。

我做错了什么,为什么我看不到变化?

1 个答案:

答案 0 :(得分:7)

你制作了一张图片......标记为“&lt; none&gt;”的图像在您的docker images命令中。但是,当您尝试运行容器时,您使用了基于新映像的旧映像。您的更改是在新图片中,而不是旧图片。

要使其正常工作,您必须使用名称标记新图像并使用该名称...

use Illuminate\Http\Request;

public function testMethod(Request $request)
{
   $someCountry = $request->user()->country; //gets the logged in user country
   dd($someCountry); //dd is die and dump, could be used for debugging purposes like var_dump() method
}
相关问题