docker映像实际存储在macOS上的什么位置?

时间:2019-01-11 14:59:30

标签: macos docker

以下显示了一些位置。 https://forums.docker.com/t/where-are-images-stored-on-mac-os-x/17165/4

但是我看不到哪个文件对应于哪个图像。有人可以告诉我如何弄清楚每个图像的物理位置吗?谢谢。

$ docker ps  -a
CONTAINER ID        IMAGE                                         COMMAND             CREATED             STATUS                  PORTS               NAMES
a06b2d5530d4        gcc:4.9                                       "bash"              3 days ago          Up 3 days                                   awesome_northcutt
99bfd1b8c105        ubuntu                                        "bash"              3 days ago          Exited (0) 3 days ago                       heuristic_clarke
16a89b2caa3c        ubuntu                                        "/bin/bash"         3 days ago          Exited (0) 3 days ago                       xenodochial_lamarr
3137d54a035d        ubuntu                                        "bash"              8 days ago          Exited (0) 8 days ago                       eager_napier
60714fa75fc4        hello-world                                   "/hello"            8 days ago          Exited (0) 8 days ago                       zen_pare
a78b73509455        hello-world                                   "/hello"            8 days ago          Exited (0) 8 days ago                       adoring_visvesvaraya
b5ea8abe5858        hello-world                                   "/hello"            8 days ago          Exited (0) 8 days ago                       brave_tesla
$ cd $HOME/Library/Containers/com.docker.docker/Data/
$ ls -Rg
.:
total 0
srwxr-xr-x 1 staff   0 Jan  2 19:44 backend.sock
drwxr-xr-x 3 staff  96 Feb 16  2018 database
srwxr-xr-x 1 staff   0 Jan  2 19:44 docker.sock
srwxr-xr-x 1 staff   0 Jan  2 19:44 osxfs.sock
-rw-r--r-- 1 staff   0 Feb 16  2018 task.lock
drwxr-xr-x 6 staff 192 Jan  2 19:44 tasks
drwxr-xr-x 3 staff  96 Jan  2 19:44 vms
srwxr-xr-x 1 staff   0 Jan  2 19:44 vpnkit.diag.sock
srwxr-xr-x 1 staff   0 Jan  2 19:44 vpnkit.eth.sock
srwxr-xr-x 1 staff   0 Jan  2 19:44 vpnkit.pcap.sock
srwxr-xr-x 1 staff   0 Jan  2 19:44 vpnkit.port.sock

./database:
total 0

./tasks:
total 16
-rw-r--r-- 1 staff  235 Jan  2 19:44 com.docker.driver.amd64-linux
-rw-r--r-- 1 staff 1064 Jan  2 19:44 com.docker.hyperkit
-rw-r--r-- 1 staff  343 Jan  2 19:44 com.docker.osxfs
-rw-r--r-- 1 staff 1337 Jan  2 19:44 com.docker.vpnkit

./vms:
total 0
drwxr-xr-x 18 staff 576 Jan  2 19:44 0

./vms/0:
total 7712512
srwxr-xr-x 1 staff           0 Jan  2 19:44 00000002.000005f4
srwxr-xr-x 1 staff           0 Jan  2 19:44 00000002.00001000
srwxr-xr-x 1 staff           0 Jan  2 19:44 00000002.00001001
srwxr-xr-x 1 staff           0 Jan  2 19:44 00000002.0000f3a5
srwxr-xr-x 1 staff           0 Jan  2 19:44 00000003.000005f5
srwxr-xr-x 1 staff           0 Jan  2 19:44 00000003.00000948
-rw-r--r-- 1 staff 63999836160 Jan 11 08:55 Docker.raw
-rw-r--r-- 1 staff      192512 Jan  2 19:44 config.iso
srwxr-xr-x 1 staff           0 Jan  2 19:44 connect
lrwxr-xr-x 1 staff          17 Jan  2 19:44 guest.000005f5 -> 00000003.000005f5
lrwxr-xr-x 1 staff          17 Jan  2 19:44 guest.00000948 -> 00000003.00000948
-rw-r--r-- 1 staff        2304 Jan  2 19:44 hyperkit.json
-rw-r--r-- 1 staff           5 Jan  2 19:44 hyperkit.pid
drwxr-xr-x 2 staff          64 Jan  2 19:44 log
-rw-r--r-- 1 staff          36 Jan  2 19:44 nic1.uuid
lrwxr-xr-x 1 staff          12 Jan  2 19:44 tty -> /dev/ttys184

./vms/0/log:
total 0

2 个答案:

答案 0 :(得分:1)

screen ~/Library/Containers//com.docker.docker/Data/vms/0/tty

此命令应将您带到MAC上所需的docker文件系统

答案 1 :(得分:0)

Docker不能在Mac上本地运行,因为macOS内核不兼容(即BSD与Linux)。 Docker实际上是使用HyperKit在虚拟机中运行的。

上面列出的Docker.raw是该虚拟机的虚拟磁盘。

所有docker映像都存储在虚拟机内部(在Docker.raw文件中),因此您无法在Mac文件系统上看到它们。