I have tried hello world node.js with docker. I have created an image & container. I exported the container using
docker export $container_ID > container_ID.tar
Q. How to run it after importing it back ?
docker import - <user-name>/node-hello < container_ID.tar
docker run -p 49610:8080 -d <user-name>/node-hello
Error: create: No command specified
I found a a git hub issue import error
solution given here is :
docker run -p 49610:8080 -d <user-name>/node-hello /someCommandToRun.sh
I tried adding Dockerfile commands like (ADD ./src;cd ./src;npm install ; CMD['node','./src/index.js']) but the image fails with exit 127
Q. What is the command to give the node-hello-world image to run ?
docker run
takes a command to run as its final argument. The command must exist in the container. For example, docker run <image> bash
will run bash
in the container and then immediately exit. To have an interactive bash shell in the container use docker run -t -i <image> bash
.
docker run
does not take Dockerfile commands like ADD
and CMD
. To use a Dockerfile, put all your commands in a file called Dockerfile
, then use docker build -t="some tag name" .
to build the image.
You should begin with the Getting Started guide to better understand Docker.
Q. How to run it after importing it back ?
Ans: docker run -p 49610:8080 -d <user-name>/node-hello /someCommandToRun.sh
Q. What is the command to give the node-hello-world image to run ?
Ans :docker run -p 49610:8080 -d <user-name>/node-hello node /src/index.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With