Skip to content

Instantly share code, notes, and snippets.

@aanand
aanand / Dockerfile
Last active January 2, 2016 14:39
Dockerfile ADD caching bug
FROM ubuntu
ADD foo.txt /foo.txt
$ cat fig.yml
web:
build: ./web
command: npm ls
ports:
- 3000:3000
$ fig up
Recreating koafig_web_1...
Attaching to koafig_web_1
koafig_web_1 | [email protected] /code
$ cat fig.yml
web:
build: ./web
command: find .
ports:
- 3000:3000
$ fig up
Recreating koafig_web_1...
Attaching to koafig_web_1
koafig_web_1 | .
$ cat fig.yml
dckr:
image: ubuntu
command: ls /
volumes:
- /var/run/docker.sock:/docker.sock
$ fig up
Creating figldleworktest_dckr_1...
Attaching to figldleworktest_dckr_1
$ cat fig.yml
dckr:
image: ubuntu
command: ls -l /
volumes:
- /var/run/docker.sock:/docker.sock
$ fig run dckr bash
root@dac750a9bcb3:/# apt-get install -y netcat > /dev/null
root@dac750a9bcb3:/# nc -U /docker.sock
$ curl 'http://localhost:4243/v1.10/version'
{"Arch":"amd64","GitCommit":3600720,"GoVersion":"go1.2.1","KernelVersion":"3.8.0-29-generic","Os":"linux","Version":"0.9.1"}
$ curl --no-buffer -X POST 'http://localhost:4243/v1.10/images/create?fromImage=ubuntu&tag='
{"status":"Pulling repository ubuntu"}
{"status":"Pulling image (raring) from ubuntu","progressDetail":{},"id":"eb601b8965b8"}{"status":"Pulling image (raring) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/","progressDetail":{},"id":"eb601b8965b8"}{"status":"Pulling image (lucid) from ubuntu","progressDetail":{},"id":"9cc9ea5ea540"}{"status":"Pulling image (lucid) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/","progressDetail":{},"id":"9cc9ea5ea540"}{"status":"Pulling image (saucy) from ubuntu","progressDetail":{},"id":"9f676bd305a4"}{"status":"Pulling image (saucy) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/","progressDetail":{},"id":"9f676bd305a4"}{"status":"Pulling image (precise) from ubuntu","progressD
func randomHexString(length int) (string, error) {
chars := "01234567890abcdef"
bytes := make([]byte, length)
for idx, _ := range bytes {
num, err := rand.Int(rand.Reader, big.NewInt(int64(len(chars))))
if err != nil {
return "", err
}
bytes[idx] = chars[num.Int64()]
}
@aanand
aanand / gist:fb1fb3ea406d8e37accf
Created June 24, 2014 18:33
Unexplored libswarm topics

Comment on this Gist with any present or potential concerns regarding the design and use of libswarm.

from sqlalchemy import create_engine, Table, Column, String, LargeBinary, MetaData
from sqlalchemy.sql import select
from io import BytesIO
class SQLStorage(object):
def __init__(self, url):
engine = create_engine(url)
self.conn = engine.connect()

Preview build: Container grouping and stack composition

NOTE: this is out of date - refer to moby/moby#9694

Here is a preview build of two new features we’re working on concurrently: container grouping (docker groups) and stack composition (docker up). Together, they will eventually form a complete replacement for Fig.