Skip to content

Instantly share code, notes, and snippets.

Rectifier

The diode bridge is the simplest rectifier I know.

Rectifier lets you share a directory with a docker container (just like $yourvm shared folders).

You don't have to install anything in your containers, and you only need to install diod in the host. diod is packaged on Ubuntu/Debian distros, and will automatically be apt-get install-ed if needed.

Since it uses diod to make a bridge, I called it rectifier. Yeah, that sucks, so if you have a better name, I'll steal it!

@metalivedev
metalivedev / nginx.conf
Created June 14, 2013 22:17
Nginx config to proxy docker on localhost
add this to your /etc/nginx/sites-enabled/default
location /docker/ {
proxy_pass http://localhost:4243/;
}
In context:
server {
#listen 80; ## listen for ipv4; this line is default and implied
--add-module=/build/buildd/nginx-1.2.2/debian/modules/nginx-auth-pam
--add-module=/build/buildd/nginx-1.2.2/debian/modules/nginx-dav-ext-module
--add-module=/build/buildd/nginx-1.2.2/debian/modules/nginx-echo
--add-module=/build/buildd/nginx-1.2.2/debian/modules/nginx-upstream-fair
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-log-path=/var/log/nginx/access.log
--http-proxy-temp-path=/var/lib/nginx/proxy
@metalivedev
metalivedev / gist:6084290
Last active December 20, 2015 06:18
Playing with stdin and out on a docker container
vagrant@precise64:~/src/wctest$ cat Dockerfile
FROM base
ENTRYPOINT ["wc"]
vagrant@precise64:~/src/wctest$ cat Dockerfile | docker run -i rufus/wc -
vagrant@precise64:~/src/wctest$ docker ps -a
ID IMAGE COMMAND CREATED STATUS PORTS
44c791634de4 rufus/wc:latest wc - 8 seconds ago Exit 0
969d44ad3004 rufus/wc:latest wc - 2 minutes ago Exit 0
cef084dba8ec rufus/wc:latest wc - 2 minutes ago Up 2 minutes
@metalivedev
metalivedev / gist:6085112
Created July 26, 2013 00:33
42 Layer Limit to AUFS using "base" image
Sample Dockerfile, then sample build output
#--------------
FROM base
RUN echo Layer 0 >> layerfile.txt
RUN echo Layer 1 >> layerfile.txt
RUN echo Layer 2 >> layerfile.txt
RUN echo Layer 3 >> layerfile.txt
RUN echo Layer 4 >> layerfile.txt
@metalivedev
metalivedev / 2007-hostint.diff
Created October 9, 2013 02:45
fix up host_integration.rst
diff --git a/docs/sources/use/host_integration.rst b/docs/sources/use/host_integration.rst
index cc2f56a..47d9ea7 100644
--- a/docs/sources/use/host_integration.rst
+++ b/docs/sources/use/host_integration.rst
@@ -2,67 +2,124 @@
:description: How to generate scripts for upstart, systemd, etc.
:keywords: systemd, upstart, supervisor, docker, documentation, host integration
+
+
@metalivedev
metalivedev / docprs.py
Last active December 28, 2015 09:19
Quick hack to check the Docker project pull requests for requests that have docs in them. This lists them and sets the label to "doc" so I can later find them easily in the github UI. Also makes a nice list of the docs being modified so I can check them for conflicts.
import requests
import json
mytoken = 'SECRET_PERSONAL_TOKEN_SEE:https://github.com/settings/applications'
url = 'https://api.github.com/repos/dotcloud/docker'
addlabels = {}
labelarray = [ '/project/doc' ] #start with the docs label, and then any others for code
addlabels['docs'] = json.dumps( labelarray )
# We're not going to add a second lable for code anymore
# since the core team will be watching all PRs.
@metalivedev
metalivedev / Dockerfile-RTD
Last active January 2, 2016 04:39
Containerizing RTD. Requires 1GB of RAM to compile in a VM. This version does all the apt-get's in one layer and sets up the database. You'll still need to use ./manage.py updatepassword manually -- haven't figured out how to automate that yet.
FROM ubuntu
# Add the Universe to the repo list
RUN echo 'deb http://us.archive.ubuntu.com/ubuntu/ precise universe' >> /etc/apt/sources.list
RUN echo 'deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe' >> /etc/apt/sources.list
# You might also need redis, nginx, postgres, and celeryd to work like production RTD.
# openssh-server is optional and just makes it easier to interact with the container later.
RUN apt-get update && apt-get install -y gcc git openssh-server python-pip python-dev libxml2-dev libxslt1-dev
RUN git clone http://github.com/rtfd/readthedocs.org.git
RUN cd readthedocs.org && pip install -r pip_requirements.txt
@metalivedev
metalivedev / macosxerror.txt
Last active August 29, 2015 13:56
Error on trivial Mac OS X / docker/ boot2docker interaction.
mac$ VirtualBox -?
Oracle VM VirtualBox Manager 4.3.6
(C) 2005-2013 Oracle Corporation
...
mac$ cd src/boot2docker/
mac$ ./boot2docker init
mac$ ./boot2docker up
mac$ export DOCKER_HOST=tcp://
mac$ ./docker version
"""
Exports Issues from a specified repository to a CSV file
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to. Supports Github API v3.
"""
import csv
import requests