Automation · Container Automation
Docker API
Cheat sheet · https://pcornel.dk/topic.php?topic=5783
Answer
The Docker API is the REST interface of the Docker daemon, used by the CLI and by SDKs such as docker-py. Never expose it unprotected over TCP, as it gives root on the host.
Remember
- Never expose the API unprotected over TCP.
- It gives root on the host.
- Use TLS client certs if remote.
First checks
curl --unix-socket /var/run/docker.sock http://localhost/v1.45/containers/json— Docker Engine API- SDK (docker-py) usage — automation
- Socket access restricted — security
Verify in this order
client → socket/API → daemon
Where it usually breaks
Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5783