3

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?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Dhanesh Agrawal
  • 323
  • 2
  • 6
  • 16
  • 1
    It doesn't immediately look like the file you have is an exported Docker image (that wouldn't usually be named `*.img`); you might have more luck using the system that originally created it. – David Maze Feb 18 '19 at 00:26
  • @DavidMaze .. Thanks .. I can check that with my friend but the strange thing for me is the docker import works. Incase of invalid docker image shouldn't it give me an error ? – Dhanesh Agrawal Feb 18 '19 at 00:30
  • 1
    If you have to use `docker import`, it's not a valid image. (`docker load` would be somewhat more typical but still unusual.) The error you're getting is because the image you have doesn't have a default `CMD` at all, but all of the standard base images define _something_ as a command (generally a shell). – David Maze Feb 18 '19 at 00:33

3 Answers3

1

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.

pixie999
  • 468
  • 5
  • 11
  • For command "docker run -it -p 8888:80 bwise:version1.0 sh " it fails with another error but I assume this is something to do with the mount flags in docker service. I am using windows 10. Error : docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"sh\": executable file not found in $PATH": unknown. – Dhanesh Agrawal Feb 18 '19 at 00:43
  • 1
    @DhaneshAgrawal Try /bin/sh instead. – Thorbjørn Ravn Andersen Feb 18 '19 at 00:49
  • @ThorbjørnRavnAndersen .. The same .. Command : PS C:\Users\C61464> docker run -it -p 8888:80 bwise:version1.0 /bin/sh Output : C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory": unknown. – Dhanesh Agrawal Feb 18 '19 at 00:59
  • Is the image you're running *nix based? What is the OS your image is based on ? – pixie999 Feb 18 '19 at 01:41
  • @pixie999 .. I will check if the image is based on *nix or not. The OS is shown as "linux" when I run command : docker inspect image_name – Dhanesh Agrawal Feb 18 '19 at 14:39
  • Hello , How to run/install a docker image. I pulled an image from drive. so i have docker image i have docker already installed –  Jun 20 '20 at 08:41
0

The docker image may be broken.

Look inside. See suggestions how to in How to see docker image contents

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • 1) docker image history --no-trunc image_name > image_history : only gives the time and sha ID when this image was run. 2) docker inspect image_name : Gives the config with null values for cmd, entrypoint and details about os,architecture,layers etc. – Dhanesh Agrawal Feb 18 '19 at 14:33
0

Run this command to inspect your image

docker inspect [docker-image-name]

Inspect you will see base image and other info about that image

  • Hello , How to run/install a docker image. I pulled an image from drive. so i have docker image i have docker already installed –  Jun 20 '20 at 08:41