Search code examples
javadockerdockerfiledocker-machineboot2docker

How to run container from image build from tar?


I have imported java:8 images from tarball using below command,

cat softwares/jdk-8.tar.gz | docker import - java:8

and the image is created successfully as below

REPOSITORY TAG IMAGE ID CREATED SIZE java 8 2e54a3ae451d 20 minutes ago 376MB

then I ran the command, docker run -it java:8 bash, it is giving the following error

docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"bash\": executable file not found in $PATH".

Can anyone help me What I am doing wrong?


Solution

  • This is not a valid image. What you are getting is a file system with the java package being extracted and mounted on the root filesystem.

    The error is justified and it tells you that bash is not available in this image. The examples given in the docker documentation for the import command, are about importing a docker image that is packaged not a random package of a software source. If you want java in a container use the already avaiable java images.