Image

Images would be from the depots, including

  • local: images had been downloaded in local disk
  • qnap: images selected by QNAP, which needs to be download before using
  • dockerhub: images located in Docker Hub, which needs to be downloaded before using

Inspect & tags

GET /api/v1/image/(string: image_type)/(string: image_name)/(string: image_tag)/inspect

Inspect image information.

Parameters:
  • image_typedocker
  • image_name – image name
  • image_name – image tag, which is latest or other version number

Example request

$ curl -sq -XGET -b cookies.txt \
    "http://${QIP}:${QPORT}/api/v1/image/docker/ubuntu/latest/inspect"

Example response

{
    "Architecture": "amd64",
    "Author": "",
    "Comment": "",
    "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "/bin/bash"
        ],
        "CpuShares": 0,
        "Cpuset": "",
        "Domainname": "",
        "Entrypoint": null,
        "Env": null,
        "ExposedPorts": null,
        "Hostname": "9ec8c01a6a48",
        "Image": "37bea4ee0c816e3a3fa025f36127ef8ef0817b3f8fcd7b49eb7b26064f647bb0",
        "Labels": {},
        "MacAddress": "",
        "Memory": 0,
        "MemorySwap": 0,
        "NetworkDisabled": false,
        "OnBuild": null,
        "OpenStdin": false,
        "PortSpecs": null,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": null,
        "WorkingDir": ""
    },
    "Container": "a07d9edec0b3a777941a33087d8351d31f9aadce9418ad628de5e05dcebe8a3f",
    "ContainerConfig": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "/bin/sh",
            "-c",
            "#(nop) CMD [\"/bin/bash\"]"
        ],
        "CpuShares": 0,
        "Cpuset": "",
        "Domainname": "",
        "Entrypoint": null,
        "Env": null,
        "ExposedPorts": null,
        "Hostname": "9ec8c01a6a48",
        "Image": "37bea4ee0c816e3a3fa025f36127ef8ef0817b3f8fcd7b49eb7b26064f647bb0",
        "Labels": {},
        "MacAddress": "",
        "Memory": 0,
        "MemorySwap": 0,
        "NetworkDisabled": false,
        "OnBuild": null,
        "OpenStdin": false,
        "PortSpecs": null,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": null,
        "WorkingDir": ""
    },
    "Created": "2015-04-30T21:50:13.355542328Z",
    "DockerVersion": "1.6.0",
    "Id": "07f8e8c5e66084bef8f848877857537ffe1c47edd01a93af27e7161672ad0e95",
    "Os": "linux",
    "Parent": "37bea4ee0c816e3a3fa025f36127ef8ef0817b3f8fcd7b49eb7b26064f647bb0",
    "Size": 0,
    "VirtualSize": 188304295
}
GET /api/v1/image/(string: image_type)/(string: image_name)/(string: image_tag)/remote_inspect

Inspect image information.

Parameters:
  • image_typedocker
  • image_name – image name
  • image_name – image tag, which is latest or other version number

Example request

$ curl -sq -XGET -b cookies.txt \
    "http://${QIP}:${QPORT}/api/v1/image/docker/redis/latest/remote_inspect"

Example response

Failed to run command
curl -sq -XGET -b cookies.txt     "http://${QIP}:${QPORT}/api/v1/image/docker/redis/latest/remote_inspect" | python -m json.tool
GET /api/v1/image/dockerhub/docker/(string: is_official)/(string: image_name)/tags

Get image tags from Docker Hub. It will take a few seconds to finish.

Parameters:
  • is_official – if image is official, it should be 1. Otherwise it should be 0.
  • image_name – image name
Response JSON Object:
 
  • installed (array) – tags have been installed in local
  • tags (array) – all tags of request image

Example request

$ curl -sq -XGET -b cookies.txt \
    "http://${QIP}:${QPORT}/api/v1/image/dockerhub/docker/1/redis/tags"

Example response

{
    "installed": [],
    "tags": [
        "latest",
        "2",
        "2.6",
        "2.6.17",
        "2.8",
        "2.8.10",
        "2.8.11",
        "2.8.12",
        "2.8.13",
        "2.8.14",
        "2.8.15",
        "2.8.16",
        "2.8.17",
        "2.8.18",
        "2.8.19",
        "2.8.20",
        "2.8.6",
        "2.8.7",
        "2.8.8",
        "2.8.9",
        "3",
        "3.0",
        "3.0.0",
        "3.0.1"
    ]
}

Download

POST /api/v1/image/(string: repository)/(string: image_type)/(string: image_name)/(string: image_tag)/download

Download the image from QNAP or Docker Hub

Parameters:
  • repositorydockerhub, qnap
  • image_typelxc, docker
  • image_name – image name
  • image_tag – image tag, which is latest or other version number
Request JSON Object:
 
  • description (string) – description of this image
  • location (string) – url of this image
  • icon (string) – icon source of this image

Example request

$ curl -sq -XPOST -b cookies.txt -d \
    '{
        "description": "I am description.",
        "location": "https://registry.hub.docker.com/u/lgsd/diamond/",
        "icon": "http://download.qnap.com/QPKG/images/QPKG/container_icon.png"
    }' "http://${QIP}:${QPORT}/api/v1/image/dockerhub/docker/lgsd/diamond/latest/download"

Example response

{}
GET /api/v1/image/downloadstatus

Get all downloading image status.

Example request

$ curl -sq -XGET "http://${QIP}:${QPORT}/api/v1/image/downloadstatus"

Example response

[
    {
        "name": "lgsd/diamond",
        "percent": null,
        "status": "downloading"
    }
]
DELETE /api/v1/image/(string: repository)/(string: image_type)/(string: image_name)

Remove image function which is only used in local image. This request will take few seconds to finish.

Parameters:
  • repositorylocal
  • image_typelxc, docker
  • image_name – image name

Example request

$ curl -sq -XDELETE "http://${QIP}:${QPORT}/api/v1/image/local/docker/lgsd/diamond"

Example response

{
    "error": {
        "code": 404,
        "message": "Image not found: lgsd/diamond"
    }
}