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 test-port.sh
#!/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
@dqminh
dqminh / Dockerfile
Last active Aug 29, 2015
7600-zombie dockerfiles
View Dockerfile
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
View gist:1de3a3bfcf7d58480c56
# Dockerfile
ENV name value
ENV name2 value2
VOLUME /test1
# EOF
# normal AST
(env name value)
(env name2 value2)
(volume /test1)
View gist:67912a80278983617c8d
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
"RestartPolicy": {"Name": "always"}
}
View gist:d95056237acbbf5e3d37
// 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))
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)
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 gist:cfe6c2b5b246410c2998
ADD ./composer.json /app/composer.json
RUN composer install
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: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
You can’t perform that action at this time.