supereagle / experiences

Summary of practical experience in work.
2 stars 0 forks source link

Comparation of Docker Go clients #30

Closed supereagle closed 7 years ago

supereagle commented 7 years ago

Choices

Both of them implement the Docker Engine API. But go-dockerclient is much EASIER to use as it composes the response of Docker engine APIs.

Take container logs as an example

func (c *Client) Logs(opts LogsOptions) error { if opts.Container == "" { return &NoSuchContainer{ID: opts.Container} } if opts.Tail == "" { opts.Tail = "all" } path := "/containers/" + opts.Container + "/logs?" + queryString(opts) return c.stream("GET", path, streamOptions{ setRawTerminal: opts.RawTerminal, stdout: opts.OutputStream, stderr: opts.ErrorStream, inactivityTimeout: opts.InactivityTimeout, context: opts.Context, }) }


* Official client
https://github.com/moby/moby/blob/v17.05.0-ce/client/container_logs.go