使用official documentation中提供的curl命令curl --unix-socket /var/run/docker.sock http:/containers/json?all=1
,我得到了机器上所有容器的JSON结果。
[{"Id":"b20b26f300f86125466716cf70f3d105b7e55c7bef103276d6b4e6244a0fbd2e","Names":["/generated_898522226"],"Image":"nginx","ImageID":"sha256:eb4a127a1188a3e274eb38f079c5e11680b942927956a38b9b6b6c6736e14fd2","Command":"nginx -g 'daemon off;'","Created":1463082026,"Ports":[],"Labels":{},"State":"exited","Status":"Exited (0) 18 hours ago","HostConfig":{"NetworkMode":"default"},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"","EndpointID":"","Gateway":"","IPAddress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":""}}},"Mounts":[]},{"Id":"dfe7908b7de93b0bfee8be0043e30f103e3f98bf1ec5cd04d569bf626449b23d","Names":["/generated_1639068228"],"Image":"nginx","ImageID":"sha256:eb4a127a1188a3e274eb38f079c5e11680b942927956a38b9b6b6c6736e14fd2","Command":"nginx -g 'daemon off;'","Created":1463081989,"Ports":[],"Labels":{},"State":"exited","Status":"Exited (0) 18 hours ago","HostConfig":{"NetworkMode":"default"},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"","EndpointID":"","Gateway":"","IPAddress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":""}}},"Mounts":[]}]
但是,当我执行以下命令时; curl --unix-socket /var/run/docker.sock http:/containers/b20b26f300f8/start
,它告诉我404 page not found
。在JSON结果中存在id,当我尝试启动时它是怎么找不到的?