Skip to content

Instantly share code, notes, and snippets.

View vbatts's full-sized avatar
🧁

Vincent Batts vbatts

🧁
View GitHub Profile
@vbatts
vbatts / 408-3-vhost_switch_proxypass_from_rewrite.rb
Last active August 29, 2015 13:56
vhost proxypass migration
#!/usr/bin/env oo-ruby
=begin
Author: Vincent Batts <vbatts@redhat.com>
Data: Fri Feb 28 15:42:09 EST 2014
Description: Migration script for https://trello.com/c/q1ro2vDB/408-3-use-proxy-pass-for-virtual-hosts-plugin-instead-of-mod-rewrite
NOTE: this only applies to setups that are using the vhost plugin, namely OSE
=end
require "find"
require "json"

== For a static file-system (not an interactive registry daemon)

-- Overview For use-cases of serving docker images from a registry, that is to be read-only (pull or run, no push). It is necessary to make certain aspects of the index/registry API optional. This way the HTTP GET's made for pulling an image and layers, are provided by a basic file system server and no added logic.

Presently, there are a few custom headers that are expected of the registry, by the docker tool. If the headers are not present, then the pull of the image fails. The functionality that is using these headers ought to have some sane defaults if they are not present.

-- Example Using the attached server (though any http server like httpd or lighttpd would work too), to serve a directory. The directory fetched from http://people.gnome.org/~alexl/v1.tar.gz, looks like:

@vbatts
vbatts / f.go
Last active August 29, 2015 13:57
docker image/layer sums
package main
import (
"compress/gzip"
"flag"
"fmt"
"github.com/dotcloud/docker/image"
"github.com/dotcloud/docker/utils"
"io"
"io/ioutil"
@vbatts
vbatts / README.md
Last active August 29, 2015 13:58
docker vs. registry: tar length discrepancy

Overview

there has been a 1024 byte discrepancy of the tar archive when pushed from a docker daemon to a docker-registry

Usage

$ sh repro.sh

or if you are testing a local build of docker

@vbatts
vbatts / Dockerfile
Created April 8, 2014 20:25
hunting for TarSum inconsistencies
FROM fedora:latest
RUN yum install -y attr golang git docker-registry
# this way we'll set something in a non-standard tar pax header for this image
RUN touch file && setfattr -n user.vbatts -v test ./file && getfattr -d ./file
#
RUN curl -kL https://github.com/dotcloud/docker/archive/v0.9.1.tar.gz | tar -zx
RUN mkdir -p /gopath/src/github.com/dotcloud && \
@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