Skip to content

Instantly share code, notes, and snippets.

View crosbymichael's full-sized avatar

Michael Crosby crosbymichael

View GitHub Profile
package main
import (
"flag"
"fmt"
"github.com/mattn/go-gntp"
"log"
"os"
)
FROM ubuntu
RUN apt-get install mongodb
...
docker tag <id> mongodb
...
@crosbymichael
crosbymichael / links.py
Created October 2, 2013 18:51
Docker-py linking
@crosbymichael
crosbymichael / upgrade-lxc.sh
Created October 31, 2013 19:06
Docker on Ubuntu 13.10
#!/bin/bash
# Remove current lxc version which is lxc/1.0.0~alpha1-0ubuntu11
sudo apt-get remove lxc
# Download the new pakcages with the updated
wget https://launchpad.net/ubuntu/+source/lxc/1.0.0~alpha1-0ubuntu12/+build/5171688/+files/lxc_1.0.0~alpha1-0ubuntu12_amd64.deb
wget https://launchpad.net/ubuntu/+source/lxc/1.0.0~alpha1-0ubuntu12/+build/5171688/+files/liblxc0_1.0.0~alpha1-0ubuntu12_amd64.deb
# Install the updated packages
POST /containers/(id)/start HTTP/1.1
{
"Binds": null,
"ContainerIDFile": "",
"Links": null,
"LxcConf": [],
"PortBindings": {
"6379/tcp": null
},
# I'm the nginx container and I server static content from /data and nothing more
docker run -v /data -name nginx nginx-image --serve-from /data #fake flag or whatever
# I'm the site generator, i take files and put thing in a dir
docker run -volumes-from nginx site-generator --from /my-work-tree --dest /data
full post # http://crosbymichael.com/advanced-docker-volumes.html
➜ ~ docker run -t -i -d -p 4000:4000 ubuntu bash
6d057d7fd0f3
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6d057d7fd0f3 ubuntu:12.04 bash 2 seconds ago Up 1 seconds 0.0.0.0:4000->4000/tcp fuchsia_octopus
e9f7b05dc5c0 crosbymichael/frontend:latest python todo.py 2 hours ago Up About an hour 0.0.0.0:49154->5000/tcp todo
4441a96922d7 crosbymichael/rethinkdb:latest /usr/bin/rethinkdb - 2 hours ago Up 2 hours 0.0.0.0:49153->8080/tcp, 28015/tcp, 29015/tcp rethinkdb,todo/db
➜ ~ docker stop fuchsia_octopus
fuchsia_octopus
➜ ~ docker start fuchsia_octopus
@crosbymichael
crosbymichael / gist:7376503
Last active December 27, 2015 19:19
driver failures
FAIL: TestBuild (6.25 seconds)
buildfile_test.go:261: open /tmp/docker-testf5f3-buildImage-426172253/aufs/mnt/4e6d31f3b2b490b1eb93943faa402015dd712838be18f3af7f04179c79c21b0c/usr/lib/baz/quux: no such file or directory
FAIL: TestImagesTree (3.78 seconds)
commands_test.go:800: images -tree content '└─83599e29c455 Size: 8.597 MB (virtual 8.597 MB) Tags: docker-test-image:latest
└─ecb0093b4ba6 Size: 8.566 MB (virtual 17.16 MB)
└─d95d37ce2557 Size: 8.567 MB (virtual 25.73 MB)
└─384d9c267df7 Size: 8.567 MB (virtual 34.3 MB)
└─3cf79d53d1dd Size: 8.567 MB (virtual 42.86 MB) Tags: test:latest
{
"Binds":["/tmp:/tmp"],
"LxcConf":{"lxc.utsname":"docker"},
"ContainerIDFile": "",
"Privileged": false,
"PortBindings": {"22/tcp": [{HostIp:"", HostPort:""}],"3000/tcp": [{HostIp:"", HostPort:""}]},
"Links": [],
"PublishAllPorts": false
}
# First Dockerfile
FROM ubuntu
RUN normal stuff
...
docker build -t soundtech/base .
# Second Dockerfile
FROM soundtech/base
RUN specific change