简体   繁体   中英

How to run imported image in Docker.io?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM