參考資訊:
https://sleeplessbeastie.eu/2021/12/13/how-to-query-docker-socket-using-curl/
Display docker version
$ sudo curl --silent -XGET --unix-socket /run/docker.sock http://localhost/version | jq .
Display docker details
$ sudo curl --silent -XGET --unix-socket /run/docker.sock http://localhost/info | jq .
Monitor current events
$ sudo curl --silent -XGET --unix-socket /run/docker.sock http://localhost/events
Create a container
$ sudo curl --silent -XPOST --unix-socket /run/docker.sock -d '{"Image":"nginx:latest"}' -H 'Content-Type: application/json' http://localhost/containers/create?name=nginx
Start a container
$ sudo curl --silent -XPOST --unix-socket /run/docker.sock -H 'Content-Type: application/json' http://localhost/containers/1c022ba8c88382b1bad03c5d32146f66b698b5211ea37057cb56f76537228b0e/start
List containers
$ sudo curl --silent -XGET --unix-socket /run/docker.sock -H 'Content-Type: application/json' http://localhost/containers/json | jq .
Display container details
$ sudo curl --silent -XGET --unix-socket /run/docker.sock -H 'Content-Type: application/json' http://localhost/containers/1c022ba8c88382b1bad03c5d32146f66b698b5211ea37057cb56f76537228b0e/json | jq .