docs icon indicating copy to clipboard operation
docs copied to clipboard

Write or improve code samples

Open sarahsanders-docker opened this issue 8 months ago • 11 comments

Is this a docs issue?

  • [x] My issue is about the documentation content or website

Type of issue

Other

Description

Identify an API endpoint missing a sample and write a cURL or Python example request and response.

Location

https://docs.docker.com/reference/

Suggestion

No response

sarahsanders-docker avatar May 01 '25 20:05 sarahsanders-docker

Hi @sarahsanders-docker Please could you assign this to me? Thanks!

DeeptiN1 avatar May 04 '25 16:05 DeeptiN1

✋ I'd like to contribute here, too.

davidmlentz avatar May 04 '25 17:05 davidmlentz

Endpoint: https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerList

Curl: curl --unix-socket /var/run/docker.sock -X GET http://localhost/v1.49/containers/json

davidmlentz avatar May 04 '25 17:05 davidmlentz

@davidmlentz that looks good!

sarahsanders-docker avatar May 04 '25 17:05 sarahsanders-docker

Endpoint: https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerStop

Curl: curl --unix-socket /var/run/docker.sock -X POST -v "http://localhost/v1.49/containers/{id}/stop"

davidmlentz avatar May 04 '25 17:05 davidmlentz

Endpoint: https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Image/operation/ImagePrune

Curl: curl --unix-socket /var/run/docker.sock -X POST "http://localhost/v1.49/images/prune" -H "Content-Type: application/json"

davidmlentz avatar May 04 '25 17:05 davidmlentz

Container APIs:

Container logs | https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerLogs

curl --unix-socket /var/run/docker.sock -X GET http://localhost/v1.49/containers/{id}/logs

Export a container | https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerExport

curl --unix-socket /var/run/docker.sock -X GET http://localhost/v1.48/containers/{id}/export

Resize a container | https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerResize

curl --unix-socket /var/run/docker.sock -X POST -v http://localhost/v1.49/containers/{id}/resize

Start a container | https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerStart

curl --unix-socket /var/run/docker.sock -X POST -v http://localhost/v1.49/containers/{id}/start

Stop a container | https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerStop

curl --unix-socket /var/run/docker.sock -X POST -v http://localhost/v1.49/containers/{id}/stop

Attach to a container | https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerAttach

curl --unix-socket /var/run/docker.sock -X POST -v http://localhost/v1.49/containers/{id}/attach

Remove a container | https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerDelete

curl --unix-socket /var/run/docker.sock -X DELETE -v http://localhost/v1.49/containers/{id}/stop

Get an archive of a filesystem resource in a container | https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerArchive

curl --unix-socket /var/run/docker.sock -X PUT -v http://localhost/v1.49/containers/{id}/archive

DeeptiN1 avatar May 04 '25 18:05 DeeptiN1

Endpoint: https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Image/operation/ImageCreate

Curl: curl --unix-socket /var/run/docker.sock -X POST "http://localhost/v1.49/images/create?fromImage={image}&tag={tag}"

davidmlentz avatar May 04 '25 18:05 davidmlentz

Endpoint: https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Image/operation/ImageDelete

Curl: curl --unix-socket /var/run/docker.sock -X DELETE "http://localhost/v1.49/images/{name}"

davidmlentz avatar May 04 '25 18:05 davidmlentz

Endpoint: https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Image/operation/ImageSearch Curl: curl --unix-socket /var/run/docker.sock -X GET "http://localhost/v1.49/images/search?term={term}"

davidmlentz avatar May 04 '25 20:05 davidmlentz

Endpoint: https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Image/operation/ImageList

Curl: curl --unix-socket /var/run/docker.sock -X GET "http://localhost/v1.49/images/json"

davidmlentz avatar May 04 '25 21:05 davidmlentz