I would like to obtain the created at date for a docker image using docker API. Is this possible?
I don't see it in the docs https://docker-py.readthedocs.io/en/stable/images.html.
I see a way to obtain it using requests but was hoping to use docker API as my code uses docker API to grab other information such as Registry ID.
import docker
cli=docker.from_env()
cl_image = cli.images.get_registry_data(reg_url, auth_config=None)
image_hash = cl_image.id
No, getting the creation date is not supported by the
DockerSDK for python. Thecreateattribute simply doesn't exist so you will not be able to get that value. So you will have to use therequestmodule to fetch the data fromDocker API.Note: Your import library should not be referred to as
APIit is simply a library supporting the Docker EngineAPI. The realAPIis here which you'll use it to make aGETrequest.Edit:
I am not sure if you are doing your authentication correctly. You need to provide credentials with values and encode in base64url (JSON) and pass them as
X_Registry-Authheader in your request call, see this. This example perfectly illustrates what you have to do, albeit it's shown in the context ofcURL POSTrequest.