feat: add image_inspect function

v-0.3.3
Jef Roosens 2022-12-15 11:55:04 +01:00
parent 598597f726
commit 9aebb3bedc
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
3 changed files with 21 additions and 10 deletions

View File

@ -1,11 +1,16 @@
module docker
import net.http { Method }
import types { Image }
import json
struct Image {
pub:
id string [json: Id]
pub fn (mut d DockerConn) image_inspect(image string) !Image {
d.send_request(.get, '/images/$image/json')!
_, body := d.read_response()!
data := json.decode(Image, body)!
return data
}
// pull_image pulls the given image:tag.

6
types/image.v 100644
View File

@ -0,0 +1,6 @@
module types
pub struct Image {
pub:
id string [json: Id]
}