To interact directly with the Docker Engine REST API using curl and the Unix socket without relying on standard Docker CLI lifecycle commands.
wsl
Launches Ubuntu inside Windows.

ls -l /var/run/docker.sock
Confirms Docker socket exists and shows permission details.

curl --unix-socket /var/run/docker.sock http://localhost/_ping
Expected Output: OK
Confirms Docker daemon is accessible via Unix socket.

curl --unix-socket /var/run/docker.sock http://localhost/version
Returns Docker Engine details in JSON format.

docker ps
docker ps -a
Displays running and stopped containers.

curl --unix-socket /var/run/docker.sock "http://localhost/v1.44/containers/json"
curl --unix-socket /var/run/docker.sock "http://localhost/v1.44/containers/json?all=true"
Retrieves container information in JSON format.

curl --unix-socket /var/run/docker.sock -X POST "http://localhost/v1.44/images/create?fromImage=nginx&tag=latest"
Downloads nginx image using Docker REST API.

curl --unix-socket /var/run/docker.sock -X POST -H "Content-Type: application/json" http://localhost/v1.44/containers/create?name=mynginx -d '{
"Image": "nginx",
"ExposedPorts": {
"80/tcp": {}
},
"HostConfig": {
"PortBindings": {
"80/tcp": [
{ "HostPort": "8080" }
]
}
}
}'
Creates container named mynginx with port mapping 8080 to container
port 80.

curl --unix-socket /var/run/docker.sock -X POST http://localhost/v1.44/containers/mynginx/start
Starts the created container.

curl --unix-socket /var/run/docker.sock -X POST http://localhost/v1.44/containers/mynginx/stop
Stops the running container.

curl --unix-socket /var/run/docker.sock http://localhost/v1.44/containers/mynginx/json
Displays detailed container metadata including state, mounts, networking, and port bindings.

Shows full layer download progress of nginx image via API.

Successfully accessed Docker Engine directly via its REST API and performed:
All operations were executed using HTTP requests over the Unix socket.
/var/run/docker.sock.