Skip to content

Instantly share code, notes, and snippets.

View dqminh's full-sized avatar

Daniel, Dao Quang Minh dqminh

View GitHub Profile
@dqminh
dqminh / Dockerfile
Last active August 29, 2015 14:05
7600-zombie dockerfiles
FROM tianon/dind
RUN apt-get update -y && apt-get install --no-install-recommends -y -q \
curl \
ca-certificates \
procps
RUN mkdir /nodejs && curl http://nodejs.org/dist/v0.10.30/node-v0.10.30-linux-x64.tar.gz | tar xvzf - -C /nodejs --strip-components=1
ENV PATH /nodejs/bin:$PATH
#!/bin/bash
docker run -d --name test-port -p 8000:8000 busybox sh -c "while true; do echo 'hello world'; done"
for i in {1..100}; do
echo "restart $i"
docker restart test-port
done
# Dockerfile
ENV name value
ENV name2 value2
VOLUME /test1
# EOF
# normal AST
(env name value)
(env name2 value2)
(volume /test1)
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
"RestartPolicy": {"Name": "always"}
}
// test for https://github.com/docker/docker/issues/3631
func TestRunPipeStdoutSlowStdin(t *testing.T) {
defer deleteAllContainers()
defer deleteImages("fedora")
runCommand(exec.Command(dockerBinary, "pull", "fedora"))
runCmd := exec.Command("bash", "-c",
fmt.Sprintf(`%s run -i fedora tar -cf - /usr/bin | %s run -i fedora tar -tf -`,
dockerBinary, dockerBinary))
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)
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"
ADD ./composer.json /app/composer.json
RUN composer install
@dqminh
dqminh / docker-builder.md
Created November 4, 2014 08:59
builder v2

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.
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