Slide 1

Slide 1 text

Go Docker The most popular Go project and how can you do the same. jamie sa  [email protected] Product Manager Speed 3D Inc.

Slide 2

Slide 2 text

Docker is

Slide 3

Slide 3 text

A project started by Solomon Hykes http://www.forbes.com/sites/ benkepes/2013/10/29/docker- and-the-timely-pivot/ Almost got sold that time.

Slide 4

Slide 4 text

an open source project to pack, ship and run any application as a lightweight container

Slide 5

Slide 5 text

Open Source Highly active since very begining https://github.com/trending?l=go&since=monthly

Slide 6

Slide 6 text

Lightweight Container Linux Containers LXC » Kernel namespaces (ipc, uts, mount, pid, network and user) » Chroots (using pivot_root) » Kernel capabilities » Control groups (cgroups)

Slide 7

Slide 7 text

PID namespaces in the 2.6.24 kernel struct upid { int nr; /* moved from struct pid */ struct pid_namespace *ns; /* the namespace this value is visible in */ struct hlist_node pid_chain; /* moved from struct pid */ }; struct pid { atomic_t count; struct hlist_head tasks[PIDTYPE_MAX]; struct rcu_head rcu; int level; /* the number of upids */ struct upid numbers[0]; }; November 19, 2007

Slide 8

Slide 8 text

Go-LXC Go Bindings for LXC in lxc.c pid_t go_lxc_init_pid(struct lxc_container *c) { return c->init_pid(c); } ...

Slide 9

Slide 9 text

Creating an lxc container in Go func main() { c, err := lxc.NewContainer(name, lxcpath) if err != nil { log.Fatalf("ERROR: %s\n", err.Error()) } defer lxc.PutContainer(c) log.Printf("Creating container...\n") c.SetVerbosity(lxc.Verbose) if os.Geteuid() != 0 { if err := c.CreateAsUser(distro, release, arch); err != nil { log.Printf("ERROR: %s\n", err.Error()) } } else { if err := c.Create(template, "-a", arch, "-r", release); err != nil { log.Printf("ERROR: %s\n", err.Error()) } } }

Slide 10

Slide 10 text

Before I try

Slide 11

Slide 11 text

Most of the appeal for me is not the features that Go has, but rather the features that have been intentionally left out.

Slide 12

Slide 12 text

After that certain date.

Slide 13

Slide 13 text

Why Go? 1.Static compilation 2.Netural 3.It has what we need 4.Full development environment 5.Multi-arch build Jérôme Petazzoni, Docker and Go: why did we decide to write Docker in Go?

Slide 14

Slide 14 text

Jan 19, 2013, Initial commit func (docker *Docker) Create(name string, command string, args []string, layers []string, config *Config) (*Container, error) { if docker.Exists(name) { return nil, fmt.Errorf("Container %v already exists", name) } root := path.Join(docker.repository, name) container, err := createContainer(name, root, command, args, layers, config) if err != nil { return nil, err } docker.containers.PushBack(container) return container, nil } by Andrea Luzzardi

Slide 15

Slide 15 text

Demo

Slide 16

Slide 16 text

What kind of web serivce do you use? » AWS » [.*]Azure » Linode

Slide 17

Slide 17 text

One More thing

Slide 18

Slide 18 text

Critical Mass April 19, 2014, Saturday 4PM