如何在Docker映像中查看文件(例如:Docker的“ hello-world”映像)

时间:2018-08-20 18:03:02

标签: docker

我是Docker的新手,并且对官方Docker private void showDownloadPgmPopup() { android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(getActivity(),R.style.AlertDialog); ... .. . } 映像进行了<style name="AlertDialog" parent="Base.Theme.AppCompat.Light.Dialog"> <item name="android:textColor">#000000</item> <item name="android:textColorPrimary">#595959</item> <item name="android:colorAccent">#1b5e20</item> </style> 的操作,以下是其摘录:

mViewModel.getLoadingStateObserver().observe(getViewLifecycleOwner(), loadingState -> {
    Log.d(TAG, "onCreateView() returned: " + loadingState.name());
});

问题:

  • 我认为人们需要定义一个docker inspect来使容器可执行(这样,当我执行hello-world时,就会得到通常看到的文本斑点),但是在以下输出中,我看到Entrypoint是C:\> docker inspect hello-world [ { "Id": "sha256:2cb0d9787c4dd17ef9eb03e512923bc4db10add190d3f84af63b744e353a9b34", "RepoTags": [ "hello-world:latest" ], "RepoDigests": [ "hello-world@sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc" ], "Parent": "", "Comment": "", "Created": "2018-07-11T00:32:08.432822465Z", "Container": "6b6326f6afc81f7850b74670aad2bf550c7f2f07cd63282160e5eb564876087f", "ContainerConfig": { "Hostname": "6b6326f6afc8", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/bin/sh", "-c", "#(nop) ", "CMD [\"/hello\"]" ], "ArgsEscaped": true, "Image": "sha256:6bc48d210ad4c6bbb74e02e6196a9133b57107033c09e92cac12616cad30ebcf", "Volumes": null, "WorkingDir": "", "Entrypoint": null, "OnBuild": null, "Labels": {} }, "DockerVersion": "17.06.2-ce", "Author": "", "Config": { "Hostname": "", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/hello" ], "ArgsEscaped": true, "Image": "sha256:6bc48d210ad4c6bbb74e02e6196a9133b57107033c09e92cac12616cad30ebcf", "Volumes": null, "WorkingDir": "", "Entrypoint": null, "OnBuild": null, "Labels": null }, "Architecture": "amd64", "Os": "linux", "Size": 1848, "VirtualSize": 1848, "GraphDriver": { "Data": { "MergedDir": "/var/lib/docker/overlay2/20d0631d9382f954d57631716e227ddbd42a0b383ae5e26241d5cf9fc92cbfe2/merged", "UpperDir": "/var/lib/docker/overlay2/20d0631d9382f954d57631716e227ddbd42a0b383ae5e26241d5cf9fc92cbfe2/diff", "WorkDir": "/var/lib/docker/overlay2/20d0631d9382f954d57631716e227ddbd42a0b383ae5e26241d5cf9fc92cbfe2/work" }, "Name": "overlay2" }, "RootFS": { "Type": "layers", "Layers": [ "sha256:ee83fc5847cb872324b8a1f5dbfd754255367f4280122b4e2d5aee17818e31f5" ] }, "Metadata": { "LastTagTime": "0001-01-01T00:00:00Z" } } ] 。有什么想法吗?

  • 我可以想象,如果我以交互方式运行容器,则可以深入文件系统以查看文件,但是Entrypoint图像在交互模式下不起作用。

    < / li>

2 个答案:

答案 0 :(得分:1)

有两种在docker中运行可执行文件的方式

每个可运行的docker映像都需要CMD或ENTRYPOINT。 它们在容器根命令的形式上略有不同。 有关差异,请参见this question 否则,出于所有实际目的,它们是相同的

从hello-world图片中可以看到,它有一个CMD指定为/hello

答案 1 :(得分:1)

高级其他资源

Docker Best Practices