Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command docker run create empty container

Command docker run create empty container. I mean that docker image builds successfully but when I run container there is no my changes. I am working on ubuntu 16.04 with vagrant. My docker file:

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

This is output after 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 [email protected]
npm info using [email protected]
npm info ok 
[email protected] /app
`-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
| +-- [email protected] 
| `-- [email protected] 
+-- [email protected] 
+-- [email protected] 
| `-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
| +-- [email protected] 
| +-- [email protected] 
| | +-- [email protected] 
| | `-- [email protected] 
| |   `-- [email protected] 
| `-- [email protected] 
`-- [email protected] 

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

Command 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

Next i try to run container with docker run -it node:6.2.0-wheezy /bin/bash and when i login on container i can't see for example created folders form Dockerfile and no node_modules.

What i do wrong, why i can't see changes?

like image 404
Lukasz Migut Avatar asked Dec 07 '25 07:12

Lukasz Migut


1 Answers

You built an image... it is the one tagged "< none >" in your docker images command. However, when you tried to run a container, you used the old image that you based your new image on. Your changes are in that new image, not the old one.

To get it to work you have to tag your new image with a name and use that name...

docker build -t MYIMAGENAME .
docker run -it MYIMAGENAME /bin/bash
like image 151
Paul Becotte Avatar answered Dec 10 '25 02:12

Paul Becotte