Skip to content

Instantly share code, notes, and snippets.

View vbatts's full-sized avatar
🧁

Vincent Batts vbatts

🧁
View GitHub Profile
@vbatts
vbatts / Dockerfile
Last active August 29, 2015 14:00
Convenience function, for entering a fedora development environment, while in my current working directory
FROM fedora:20
RUN yum erase -y vim-minimal &&\
yum groupinstall -y "development tools" && \
yum install -y --setopt=override_install_langs=en --setopt=tsflags=nodocs \
yum-utils \
git \
golang \
mercurial \
bzr \
@vbatts
vbatts / debug.log
Last active August 29, 2015 14:00
docker failure on assuming a volume is directory by default
vbatts@jellyroll ~ (master *) $ sudo /home/vbatts/src/docker/docker/bundles/0.10.0-dev/dynbinary/docker-0.10.0-dev -d -g /home/docker -D 2>&1 | grep SUCH
[debug] volumes.go:182 SUCH VOLUMES: map[]
[debug] volumes.go:183 SUCH BIND: map["/repro.sh":{"/home/vbatts/sandbox/reproduction/20140501-rootVolPath/repro.sh" "/repro.sh" "ro"}]
[debug] volumes.go:215 SUCH SRC DIRECTORY: %!q(bool=false)
[debug] volumes.go:288 SUCH CREATE: "/home/docker/devicemapper/mnt/51f485a015ef5882875e5c9801d6a2b85a51ea590577fbcf5d28f7263a81942d/rootfs/repro.sh", %!q(bool=false)
[debug] volumes.go:182 SUCH VOLUMES: map[]
[debug] volumes.go:183 SUCH BIND: map[]
[debug] volumes.go:215 SUCH SRC DIRECTORY: %!q(bool=true)
[debug] volumes.go:288 SUCH CREATE: "/home/docker/devicemapper/mnt/96cced7026d92dd57b7067e2a49400f118b1e4fbbc93a868a1792f63e9024633/rootfs/repro.sh", %!q(bool=true)
[debug] volumes.go:251 SUCH FART: "/home/docker/devicemapper/mnt/96cced7026d92dd57b7067e2a49400f118b1e4fbbc93a868a1792f63e9024633/rootfs/repro.sh"
FROM fedora:rawhide
RUN yum install -y mock && yum clean all
RUN curl -o go1.2.1.linux-386.tar.gz https://go.googlecode.com/files/go1.2.1.linux-386.tar.gz
RUN useradd -m -u 1000 -G wheel,mock build
RUN sed -ri 's/^(%wheel.*)(ALL)$/\1NOPASSWD: \2/' /etc/sudoers
USER build
@vbatts
vbatts / another.go
Last active August 29, 2015 14:01
get support capability
package main
/*
#include <linux/capability.h>
int has_cap_syslog() {
int ret = 0;
#ifdef CAP_SYSLOG
ret = 1;
#endif
@vbatts
vbatts / Dockerfile
Last active August 29, 2015 14:01
reproducing the failure of value.decode("utf8") in python https://github.com/akheron/cpython/blob/2.7/Lib/tarfile.py#L1393
FROM fedora:latest
RUN yum install -y attr
RUN touch file
RUN setcap 'cap_setgid,cap_setuid+ep' ./file && getcap ./file
@vbatts
vbatts / sizes.rb
Created May 20, 2014 16:09
get sizes of docker image layers
#!/usr/bin/env ruby
DOCKER = ENV["DOCKER"] || "/usr/bin/docker"
NO_VALUE = '<no value>'
def main(args)
args.each do |arg|
image_id = get_image_id(arg)
#next if image_id.length == 0
package main
import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"strings"
@vbatts
vbatts / test-env-leak.sh
Last active August 29, 2015 14:04
Docker: Environment variables are no place for secrets
#!/bin/sh
envfile=$(mktemp)
# Hard set one variable
echo FOO=bar >> ${envfile}
# and one pass through
echo BAZ >> ${envfile}
export BAZ="bif"

Definitions

  1. Image – immutable detached content that is means for instantiating a container
  2. registry – an endpoint that can serve information named images, within a namespace.
  3. image namespace – the owner scope of an image
  4. namespace identity – cryptographically safe identity or fingerprint for an image namespace

Requirements

  • definition of a registry as an endpoint for identity of a requested image’s namespace
  • detached validating of the identity of an image’s namespace
  • sane default registry of the docker hub
@vbatts
vbatts / Dockerfile
Last active August 29, 2015 14:06
centos7 builds of go1.3.1 and docker 1.2
FROM centos:latest
RUN yum groupinstall -y "development tools" && \
yum install -y yum-utils wget
RUN wget https://kojipkgs.fedoraproject.org//packages/golang/1.3.1/3.fc22/src/golang-1.3.1-3.fc22.src.rpm \
https://kojipkgs.fedoraproject.org//packages/docker-io/1.2.0/2.fc22/src/docker-io-1.2.0-2.fc22.src.rpm \
https://kojipkgs.fedoraproject.org//packages/golang-github-coreos-go-systemd/2/1.el7/src/golang-github-coreos-go-systemd-2-1.el7.src.rpm \
https://kojipkgs.fedoraproject.org//packages/golang-github-docker-libcontainer/1.1.0/10.gitdb65c35.fc22/src/golang-github-docker-libcontainer-1.1.0-10.gitdb65c35.fc22.src.rpm \
https://kojipkgs.fedoraproject.org//packages/golang-github-gorilla-mux/0/0.15.git136d54f.fc22/src/golang-github-gorilla-mux-0-0.15.git136d54f.fc22.src.rpm \
https://kojipkgs.fedoraproject.org//packages/golang-github-syndtr-gocapability/0/0.8.git3c85049.fc22/src/golang-github-syndtr-gocapability-0-0.8.git3c85049.fc22.src.rpm \
https://koj