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?

3
  • 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, 2019 at 0: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 ? Feb 18, 2019 at 0: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, 2019 at 0:33

3 Answers 3

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.

6
  • 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. Feb 18, 2019 at 0:43
  • 1
    @DhaneshAgrawal Try /bin/sh instead. Feb 18, 2019 at 0: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. Feb 18, 2019 at 0:59
  • Is the image you're running *nix based? What is the OS your image is based on ?
    – pixie999
    Feb 18, 2019 at 1: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 Feb 18, 2019 at 14:39
0

The docker image may be broken.

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

1
  • 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. Feb 18, 2019 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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.