I want to create a image for my nodejs app. I have a total code which is running on CentOS. I created a account in docker and uploaded the image using below statements.
Later in another server I am using docker pull telednacomm/node:ravi
Here its not running as I expected.
Here is my Dockerfile
FROM node:6-onbuild # Set in what directory commands will run WORKDIR /home/app # Put all our code inside that directory that lives in the container ADD . /home/app # Install dependencies RUN \ mkdir -p /home/app && \ mkdir -p /home/Node && \ cd /home/Node && \ wget https://nodejs.org/dist/v6.2.2/node-v6.2.2-linux-x64.tar.gz && \ tar -zxvf node-v6.2.2-linux-x64.tar.gz && \ cd /usr/bin && \ ln -s /home/Node/node-v6.2.2-linux-x64/bin/node node && \ ln -s /home/Node/node-v6.2.2-linux-x64/bin/npm npm # replace this with your application's default port EXPOSE 3000 # The command to run our app when the container is run CMD ["node", "app.js"]
Is this the right way to mention the Dockerfile??? After pulling the image I expected my code in /home/app. But I am not getting the code. How its actually works??? What am i missing???
docker run -d telednacomm/node:ravi
e6b778e60159cb30598b8365d5594b7e2ed3040a6502551cd963764d6664e649
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6b778e60159 telednacomm/node:ravi “node app.js” 5 seconds ago Up 4 seconds 3000/tcp amazing_golick
docker logs amazing_golick
Elasticsearch INFO: 2016-07-22T17:57:36Z
Adding connection to http://172.16.15.153:9200/
At first its not listening on the port 3000. But working normally when I run it maually (node app.js)
And also what I expected is totally different.
What I expected is
The Run whats to create a /home/app directory and copy all the code files into it. And create this /home/Node directory and download nodeJS binaries to install node & later I have to run my image. But these directories are not creating in my server when I pull the image.
After pulling the image if I want to edit the code where can I edit the files.
Suppose package.json
# Put all our code inside that directory that lives in the container ADD . /home/app
I expected all the files (whatever you are seeing in docker exec -it amazing_golick ls -l) in the directory to edit. But the folder is not created when I pull the image.