如何从 tar 构建的镜像中 运行 容器?

How to run container from image build from tar?

我已经使用以下命令从 tarball 导入了 java:8 图像,

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

如下图创建成功

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

然后我运行命令, docker run -it java:8 bash,出现以下错误

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

任何人都可以帮助我我做错了什么吗?

这不是有效的图像。你得到的是一个文件系统,其中 java 包被提取并安装在根文件系统上。

错误是有道理的,它告诉您 bash 在此图像中不可用。 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