How to run local Docker Image

时间:2019-02-18 00:16:09

标签: windows docker

I have an image that I want to run on my local machine. I took this image from my friend and not from docker-hub or any repository. The file shared is in ".img" format.

I am able to import this image on docker but unable to run.

What I did:

  1. Compress the image file from ".img" format to ".tar.gz" format so that the docker image can be imported. I used 7-zip tool to convert this.
  2. From my local I imported the docker image using this new file(.tar.gz)<
  3. Trying to run this imported image but fails.

Commands Executed:

PS C:\Users\C61464> docker import .\Desktop\regchange.tar.gz
sha256:a0008215897dd1a7db205c191edd0892f484d230d8925fd09e79d8878afa2743
PS C:\Users\C61464> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             
SIZE
<none>              <none>              7fdbbdcc59c4        2 minutes ago       1.05GB
PS C:\Users\C61464> docker tag 7fdbbdcc59c4 bwise:version1.0
PS C:\Users\C61464> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             
SIZE
bwise               version1.0          7fdbbdcc59c4        3 minutes ago       1.05GB
PS C:\Users\C61464> docker run -p 8888:80 bwise:version1.0
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: No command specified.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.

I searched a lot for this error and found that for running we need to specify the path used while creating the image(In Dockerfile) but I am not sure as I am new to docker. Am I doing something wrong or I need to have the docker file to run this image?

3 个答案:

答案 0 :(得分:0)

Perhaps the Docker Image you have had no CMD or ENTRYPOINT defined when it was built, so the docker daemon doesn't know what to do with the image

Try doing

docker run -it -p 8888:80 bwise:version1.0 sh 

(if it's a *nix based image). That should start an interactive shell.

You can do:

docker run -p 8888:80 bwise:version1.0 {command_you_want_to_run}

On the image when starting it.

答案 1 :(得分:0)

泊坞窗映像可能已损坏。

向内看。在How to see docker image contents

中查看有关如何操作的建议

答案 2 :(得分:0)

运行此命令检查您的图像

docker inspect [docker-image-name]

检查您将看到基本图像和有关该图像的其他信息