Skip to content

Instantly share code, notes, and snippets.

Daniel, Dao Quang Minh dqminh

Block or report user

Report or block dqminh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:73c01805e5f591e062ec
3643 ESC[34mINFOESC[0m[84580] GET /containers/e4dfd70059369247043ce49a70d93ea33c28f3a6fa9c613276114145ac9d1d6c/json
3644 ESC[34mINFOESC[0m[84580] +job container_inspect(e4dfd70059369247043ce49a70d93ea33c28f3a6fa9c613276114145ac9d1d6c)
3645 ESC[34mINFOESC[0m[84580] -job container_inspect(e4dfd70059369247043ce49a70d93ea33c28f3a6fa9c613276114145ac9d1d6c) = OK (0)
3646 ESC[31mERROESC[0m[84584] [warning]: couldn't run auplink before unmount: exec: "auplink": executable file not found in $PATH
3647 Untar exit status 1 write /var/lib/docker/devicemapper/devicemapper/data: no space left on device
3648 ESC[34mINFOESC[0m[84584] -job commit(e4dfd70059369247043ce49a70d93ea33c28f3a6fa9c613276114145ac9d1d6c) = ERR (1)
3649 ESC[31mERROESC[0m[84584] Handler for POST /commit returned error: Untar exit status 1 write /var/lib/docker/devicemapper/devicemapper/data: no space left on device
3650 ESC[31mERROESC[0m[84584] HTTP Error: statusCode=500 Untar exit status 1 write /var/lib/docker/devicemapper/devicema
@dqminh
dqminh / README.md
Last active Aug 29, 2015
test-zsh-subreaper
View README.md

zsh with subreaper

  • compile the test program with gcc -o test-zsh main.c
  • run it as test-zsh no-subreaper|subreaper|subreaper-reap

There are 3 modes:

  • no-subreaper: do not invoke the program with PR_SET_CHILD_SUBREAPER, so the child process of zsh will be reaped by something else ( either zsh? or PID 1)
  • subreaper: set PR_SET_CHILD_SUBREAPER, but doesnt reap child processes when receiving SIGCHLD
View sigkill-exit-code
From e924b34feae782228a7b43286a1cc6f2614f0ae1 Mon Sep 17 00:00:00 2001
From: "Daniel, Dao Quang Minh" <dqminh89@gmail.com>
Date: Sun, 11 Jan 2015 04:07:57 -0500
Subject: [PATCH] the process is sigkilled, return correct exit code
Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
---
daemon/execdriver/native/driver.go | 3 ---
vendor/src/github.com/docker/libcontainer/namespaces/exec.go | 9 ++++++++-
2 files changed, 8 insertions(+), 4 deletions(-)
View gist:008ff35618d4b3c508c9
---> Making bundle: tgz (in bundles/1.4.0-dev/tgz)
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/darwin/386/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/darwin/amd64/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/freebsd/386/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/freebsd/amd64/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/freebsd/arm/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/linux/386/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/linux/amd64/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/linux/arm/docker-1.4.0-dev.tgz
cp: cannot stat '/go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/../cross/windows/386/docker-1.4.0-dev': No such file or directory
View test.c
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/prctl.h>
pid_t pid1;
void mhandler(int signum) {
fprintf(stderr, "parent got signal %d\n", signum);
View gist:8238dd1b51a7d7ac2173
root 29602 0.1 0.7 606168 14676 ? Ssl 12:37 0:01 /home/action/bin/docker -d -D --host=unix:///var/run/docker.sock
root 30738 0.1 0.0 3168 324 pts/5 Ss+ 12:56 0:00 \_ sh
root 30813 0.0 0.0 13224 256 ? Ss 12:56 0:00 \_ nsenter-exec --nspid 30738 -- sleep 1000
root 30850 0.5 0.0 3148 72 ? S 12:56 0:00 \_ sleep 1000
View docker-builder.md

Builder v2

Current approach

Right now, the builder is very tightly coupled with docker core. The builder has the following roles:

  • process the build context
  • parse Dockerfile into sexp-expressions
  • evaluate individual sexp-expressions which may involves the following job:
    • persist configurations i.e ENV, EXPOSE, VOLUME, etc.
View gist:cfe6c2b5b246410c2998
ADD ./composer.json /app/composer.json
RUN composer install
View gist:a5d9d462a80c42ab052e
Oct 9 07:41:29 action-dev kernel: [48657.051281] type=1400 audit(1412854889.409:135): apparmor="DENIED" operation="signal" profile="docker-default" pid=9733 comm="bash" requested_mask="send" denied_mask="send" signal=term peer="unconfined"
View 0001-pass-extra-file-to-child-process-as-status-handler.patch
From 244453b367dd0f005e71f400c698fe29ad070f1b Mon Sep 17 00:00:00 2001
From: "Daniel, Dao Quang Minh" <dqminh89@gmail.com>
Date: Wed, 8 Oct 2014 10:27:55 -0400
Subject: [PATCH] pass extra file to child process as status handler
instead of using stdout/stderr as the status handler, we pass an extra file to
the child process and write `0\n` or `1\nerror message` to it and close it
after. This allow the child process to handle stdout/stderr as normal.
Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
You can’t perform that action at this time.