UNPKG

5.65 kBTypeScriptView Raw
1/// <reference types="node" />
2import Modem = require('docker-modem');
3import fs = require('fs');
4/**
5 * Class representing an image
6 */
7export declare class Image {
8 modem: Modem;
9 id: String;
10 data: Object;
11 /**
12 * Creates a new image
13 * @param {Modem} modem Modem to connect to the remote service
14 * @param {string} id Container id
15 */
16 constructor(modem: Modem, id: String);
17 /**
18 * Get low-level information on an image
19 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/inspect-an-image
20 * The reason why this module isn't called inspect is because that interferes with the inspect utility of node.
21 * @param {Object} opts Query params in the request (optional)
22 * @return {Promise} Promise return the image
23 */
24 status(opts?: Object): Promise<Image>;
25 /**
26 * History of the image
27 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/get-the-history-of-an-image
28 * @param {Object} opts Query params in the request (optional)
29 * @param {String} id ID of the image to inspect, if it's not set, use the id of the object (optional)
30 * @return {Promise} Promise return the events in the history
31 */
32 history(opts?: Object): Promise<Array<Object>>;
33 /**
34 * Push an image to the registry
35 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/push-an-image-on-the-registry
36 * @param {Object} auth Authentication (optional)
37 * @param {Object} opts Query params in the request (optional)
38 * @return {Promise} Promise return the resulting stream
39 */
40 push(auth?: Object, opts?: Object): Promise<Object>;
41 /**
42 * Tag the image into the registry
43 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/tag-an-image-into-a-repository
44 * @param {Object} opts Query params in the request (optional)
45 * @return {Promise} Promise return the image
46 */
47 tag(opts?: Object): Promise<Image>;
48 /**
49 * Remove an image from the filesystem
50 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/remove-an-image
51 * @param {Object} opts Query params in the request (optional)
52 * @return {Promise} Promise return the result
53 */
54 remove(opts?: Object): Promise<Array<Object>>;
55 /**
56 * Get an image in a tarball
57 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/get-a-tarball-containing-all-images-in-a-repository
58 * @param {Object} opts Query params in the request (optional)
59 * @return {Promise} Promise return the stream with the tarball
60 */
61 get(opts?: Object): Promise<Object>;
62}
63export default class {
64 modem: Modem;
65 constructor(modem: Modem);
66 /**
67 * Get a Image object
68 * @param {id} string ID of the secret
69 * @return {Image}
70 */
71 get(id: String): Image;
72 /**
73 * Search an image on Docker Hub
74 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/search-images
75 * @param {Object} opts Query params in the request (optional)
76 * @return {Promise} Promise return the images
77 */
78 search(opts?: Object): Promise<Array<Object>>;
79 /**
80 * Get the list of images
81 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/list-images
82 * @param {Object} opts Query params in the request (optional)
83 * @return {Promise} Promise returning the result as a list of images
84 */
85 list(opts?: Object): Promise<Array<Image>>;
86 /**
87 * Build image from dockerfile
88 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/build-image-from-a-dockerfile
89 * @file {File} file Dockerfile to build
90 * @param {Object} opts Query params in the request (optional)
91 * @param {Object} auth Registry Auth Config, see linked engine documentation for details (optional)
92 * @return {Promise} Promise return the resulting stream
93 */
94 build(file: fs.ReadStream, opts?: Object, auth?: Object): Promise<Object>;
95 /**
96 * Create an image
97 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/create-an-image
98 * @param {Object} auth Authentication (optional)
99 * @param {Object} opts Query params in the request (optional)
100 * @return {Promise} Promise return the resulting stream
101 */
102 create(auth: Object, opts?: Object): Promise<Object>;
103 /**
104 * Get all images in a tarball
105 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/get-a-tarball-containing-all-images
106 * @param {Object} opts Query params in the request (optional)
107 * @return {Promise} Promise return the stream with the tarball
108 */
109 getAll(opts?: Object): Promise<Object>;
110 /**
111 * Load image from tarball
112 * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/load-a-tarball-with-a-set-of-images-and-tags-into-docker
113 * @file {File} file Tarball to load
114 * @param {Object} opts Query params in the request (optional)
115 * @return {Promise} Promise return the stream with the process
116 */
117 load(file: fs.ReadStream, opts?: Object): Promise<Object>;
118 /**
119 * Prune images
120 * https://docs.docker.com/engine/api/v1.25/#operation/ImagePrune
121 * @param {Object} opts Query params in the request (optional)
122 * @return {Promise} Promise returning the container
123 */
124 prune(opts?: Object): Promise<String>;
125}