Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker build not working #5

Open
JigarS91 opened this issue Aug 21, 2018 · 1 comment
Open

Docker build not working #5

JigarS91 opened this issue Aug 21, 2018 · 1 comment

Comments

@JigarS91
Copy link

Hi,

I am reading the book and now on Chapter 2. As suggested I have followed the steps and created a dockerfile and app.js files.

Whenever I try to build the image it just hangs and does not proceed ahead.

Below is the Dockerfile content: -

FROM node:7
ADD app.js /app.js
ENTRYPOINT ["node", "app.js"]

Below is the app.js file content: -

const http = require('http');
const os = require('os');
console.log("Kubia server starting...");
var handler = function(request, response) {
console.log("Received request from " + request.connection.remoteAddress);
response.writeHead(200);
response.end("You've hit " + os.hostname() + "\n");
};
var www = http.createServer(handler);
www.listen(8080);

Jigars-MacBook-Pro:~ jigars$ docker build -t kubia:latest -f Dockerfile .

It doesn't go ahead from here. Not sure what is the issue. I don't find the image when I run docker images.

docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest e1ddd7948a1c 2 weeks ago 1.16MB
node 7 d9aed20b68a4 12 months ago 660MB

Let me know what am I missing. Awaiting reply at the earliest.

@hbokh
Copy link

hbokh commented Jan 5, 2019

@JigarS91 Did you manage to get this working? Because there seems to be no issue using the code from chapter 2:

$ docker build -t kubia:latest -f Dockerfile .
Sending build context to Docker daemon  3.072kB
Step 1/3 : FROM node:7
7: Pulling from library/node
ad74af05f5a2: Pull complete
2b032b8bbe8b: Pull complete
a9a5b35f6ead: Pull complete
3245b5a1c52c: Pull complete
afa075743392: Pull complete
9fb9f21641cd: Pull complete
3f40ad2666bc: Pull complete
49c0ed396b49: Pull complete
Digest: sha256:af5c2c6ac8bc3fa372ac031ef60c45a285eeba7bce9ee9ed66dad3a01e29ab8d
Status: Downloaded newer image for node:7
 ---> d9aed20b68a4
Step 2/3 : ADD app.js /app.js
 ---> 49239c868105
Step 3/3 : ENTRYPOINT ["node", "app.js"]
 ---> Running in c2e5986ae1b7
Removing intermediate container c2e5986ae1b7
 ---> 08601db3ead9
Successfully built 08601db3ead9
Successfully tagged kubia:latest
$ docker images
REPOSITORY      TAG                 IMAGE ID            CREATED                  SIZE
kubia           latest              08601db3ead9        Less than a second ago   660MB
node            7                   d9aed20b68a4        16 months ago            660MB

Possibly a Docker issue but more info is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants