Skip to content
This repository was archived by the owner on Jul 24, 2022. It is now read-only.

cpuguy83/dockerclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dockerclient

Dockerclient is a client library for Docker written in go, with a straight-forward syntax.

Usage

package main

import (
  docker "github.com/cpuguy83/dockerclient"
  
  "fmt"
  "os"
  "strings"
)

func main() {
  client, err := docker.NewClient("tcp://127.0.0.1:2375")

  containers, err := client.FetchAllContainers(true)

  if err != nil {
    fmt.Println(err)
    os.Exit(1)
  }

  for _, container := range containers {
    container, err = client.FetchContainer(container.Id)
    if err != nil {
      fmt.Println(err)
    }

    name := strings.TrimPrefix(container.Name, "/")
    fmt.Println(name)
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages