docker-api

Golang - Docker API - parse result of ImagePull

你。 提交于 2020-12-29 06:44:58
问题 I'm developing a Go script that uses the Docker API for the purposes of my project. After I login to my repository, I pull the Docker image I want, but the problem is that the ImagePull function returns an instance of io.ReadCloser, which I'm only able to pass to the system output via: io.Copy(os.Stdout, pullResp) It's cool that I can see the response, but I can't find a decent way to parse it and implement a logic depending on it, which will do some things if a new version of the image have

Golang - Docker API - parse result of ImagePull

感情迁移 提交于 2020-12-29 06:44:38
问题 I'm developing a Go script that uses the Docker API for the purposes of my project. After I login to my repository, I pull the Docker image I want, but the problem is that the ImagePull function returns an instance of io.ReadCloser, which I'm only able to pass to the system output via: io.Copy(os.Stdout, pullResp) It's cool that I can see the response, but I can't find a decent way to parse it and implement a logic depending on it, which will do some things if a new version of the image have

How to connect to an existing docker network with docker remote API (through dockerode)

时间秒杀一切 提交于 2020-01-01 17:01:24
问题 I use docker-compose to create a "park" of container inter-linked. Nothing special here, I have API/Frontend/Backend etc.. There is my docker-compose.yml : version: "2" services: api: build: ./deimos_api/docker ports: - "39999:80" volumes: - ./deimos_api:/root/deimos_api asset: build: ./deimos_asset/docker ports: - "8000:80" volumes: - ./deimos_asset:/root/deimos_asset depends_on: - api links: - api data-manager: build: ./deimos_data_manager/docker ports: - "3333:3333" volumes: - ./deimos

Build Docker Image From Go Code

允我心安 提交于 2019-12-17 13:02:14
问题 I'm trying to build a Docker image using the Docker API and Docker Go libraries (https://github.com/docker/engine-api/). Code example: package main import ( "fmt" "github.com/docker/engine-api/client" "github.com/docker/engine-api/types" "golang.org/x/net/context" ) func main() { defaultHeaders := map[string]string{"User-Agent": "engine-api-cli-1.0"} cli, err := client.NewClient("unix:///var/run/docker.sock", "v1.22", nil, defaultHeaders) if err != nil { panic(err) } fmt.Print(cli

How to build an Image using Docker API Python Client?

社会主义新天地 提交于 2019-12-14 02:27:43
问题 I just have started Docker Api and explored various parts.But I'm stuck to build an image using docker api by using python client, actually I couldn't understand how to setup various required arguments for docker client.images.build() method ? Help me, please! Thanks in advance! 回答1: According to the official documentation https://docker-py.readthedocs.io/en/stable/images.html is used to build an image using docker module of python. (The question was asked a year ago, but I'll write it for

Docker API can’t apply json filters

北慕城南 提交于 2019-12-12 19:44:27
问题 According to the https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/list-tasks, filter can be only used to get running containers with a particular service name. For some reason, I am getting a full list of all tasks regardless of their names or desired states. I can't find any proper examples of using curl with JSON requests with Docker API. I'm using the following command: A) curl -X GET -H "Content-Type: application/json" -d '{"filters":[{ "service":"demo", "desired

Pulling digest fails with blob unknown to registry

我与影子孤独终老i 提交于 2019-12-11 14:28:26
问题 Pulling Images using Docker Registry V2 API from https://hub.docker.com "code": "BLOB_UNKNOWN", "message": "blob unknown to registry", My request was https://registry.hub.docker.com/v2/library/ubuntu/blobs/sha256:391556555751770ffbcebbce4ed539454cea660c0be0a726f801c96f353a22e0 Added Authorization Bearer Token in header Getting Token first and then manifests for tag ubuntu:latest and then trying to pull images where I am failing. What may be going wrong? Any pointers? 来源: https://stackoverflow

setting ports for container in docker for docker golang api

旧城冷巷雨未停 提交于 2019-12-11 02:46:00
问题 I am looking forward to do something below like this using docker golang api cmd : docker run -t -i -p 8989:8080 "image-name" /bin/bash Also I am using golang sdk https://github.com/moby/moby/client or https://godoc.org/github.com/moby/moby/client and my docker api version is 1.30 (Client & Server both) Here is the piece of code I am using package main import ( "fmt" "github.com/docker/docker/client" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "golang

How can I use Docker Registry HTTP API V2 to obtain a list of all repositories in a docker registry?

我的梦境 提交于 2019-12-11 01:04:09
问题 An external organization that I work with has given me access to a private (auth token protected) docker registry, and eventually I would like to be able to query this registry, using docker's HTTP API V2, in order to obtain a list of all the repositories and/or images available in the registry. But before I do that, I'd first like to get some basic practice with constructing these types of API queries on a public registry such as Docker Hub. So I've gone ahead and registered myself with a

How to “delete” an image from a private Docker Registry?

旧街凉风 提交于 2019-12-10 13:10:41
问题 I'm writing an API client for docker and the registry API is difficult to work with. I'm trying to delete an image from the registry however I keep getting this error [ { code: 'UNSUPPORTED', message: 'The operation is unsupported.' } ] My steps to get this are as follows, > GET http://localhost:5000/v2/ > registry/2.0 > registry/2.0 > GET http://localhost:5000/v2/_catalog/ > { repositories: [ 'alpine' ] } > GET http://localhost:5000/v2/alpine/tags/list > { name: 'alpine', tags: [ 'latest' ]