Skip to content

Instantly share code, notes, and snippets.

@nikhilm
Created November 12, 2016 00:52
Show Gist options
  • Save nikhilm/fa1969bc57563cb447da2204dcbbef20 to your computer and use it in GitHub Desktop.
Save nikhilm/fa1969bc57563cb447da2204dcbbef20 to your computer and use it in GitHub Desktop.
2016/11/12 00:29:20 Pinged successfully
&{d4d32563d909d603a6b1d604d6902b942c922e10d838ca5683ca48f4f5c23234 [treeder/hello:latest] 94f30c9c34c2234448f1f8abf62b256fdbde30542b526fa2ee9cdba3ecba28b5 2016-10-06 00:00:00.264 +0000 UTC {4c573a7cf4a3 0 0 0 0 0 [] map[] [PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin] [/bin/sh -c #(nop) ENTRYPOINT ["sh" "hello.sh"]] <nil> [] sha256:a52e7dd7e1b87c43a90db766ebe79563a38cff39a0d14ccfdad0069e741d612e map[] /app [sh hello.sh] [] [] [] map[] false false false false false false false false } 1.9.0 0xc420348000 amd64 0 0 [] <nil>} <nil>
pull <nil>
Create <nil> API error (500): (InternalError) Internal error (0f9925f0-a86f-11e6-a25b-37d5ab1798cf)
package main
import (
"fmt"
"log"
"github.com/fsouza/go-dockerclient"
)
// Test Joyent Triton Docker auth with simple ping.
func main() {
// env vars are setup correctly to use Triton Cloud.
client, err := docker.NewClientFromEnv()
if err != nil {
log.Fatalln("Could not create client", err)
}
err = client.Ping()
if err != nil {
log.Fatalln("could not ping", err)
}
log.Println("Pinged successfully")
info, err := client.InspectImage("treeder/hello")
fmt.Println(info, err)
fmt.Println("pull", client.PullImage(docker.PullImageOptions{Repository: "treeder/hello", Tag: "latest"}, docker.AuthConfiguration{}))
conf := docker.CreateContainerOptions{
Config: &docker.Config{
Image: "treeder/hello",
CPUShares: 128,
Memory: 1073741824,
WorkingDir: "/app",
Labels: map[string]string{"com.joyent.package": "g4-standard-1G"},
},
HostConfig: &docker.HostConfig{},
}
c, err := client.CreateContainer(conf)
fmt.Println("Create", c, err)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment