Skip to content

Instantly share code, notes, and snippets.

View dqminh's full-sized avatar

Daniel, Dao Quang Minh dqminh

View GitHub Profile
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)
// 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))
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
"RestartPolicy": {"Name": "always"}
}
# Dockerfile
ENV name value
ENV name2 value2
VOLUME /test1
# EOF
# normal AST
(env name value)
(env name2 value2)
(volume /test1)
#!/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 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
func PublicMethod() {
someFunc("hello")
}
func someFunc(a String) {
}
func TestStuff(t *testing.T) {
someFunc = func(a String) {
}
@dqminh
dqminh / docker client
Last active December 22, 2015 08:29
`docker push` timed out
Pushing 75d01c1a488526899c15031b5c93d098680a73d31062662a9a58460f81cc34c9
2013/09/04 21:28:51 Received HTTP code 504 while uploading layer: <html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.4.2</center>
</body>
</html>
@dqminh
dqminh / access.log
Created September 3, 2013 03:41
docker private registry + nginx basic auth
10.143.7.175 - - [02/Sep/2013:04:08:22 +0000] "GET /v1/_ping HTTP/1.1" 200 4 "-" "Go 1.1 package http" "-"
10.143.7.175 - - [02/Sep/2013:04:08:32 +0000] "POST /v1/users/ HTTP/1.1" 201 14 "-" "Go 1.1 package http" "-"
10.143.7.175 - - [02/Sep/2013:04:08:32 +0000] "GET /v1/_ping HTTP/1.1" 200 4 "-" "Go 1.1 package http" "-"
10.143.7.175 - docker [02/Sep/2013:04:08:32 +0000] "PUT /v1/repositories/test/essential/ HTTP/1.1" 200 2 "-" "go/go1.1.1 kernel/3.8.0-29-generic" "-"
10.143.7.175 - - [02/Sep/2013:04:08:32 +0000] "GET /v1/images/8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c/json HTTP/1.1" 401 194 "-" "go/go1.1.1 kernel/3.8.0-29-generic" "-"
10.143.7.175 - - [02/Sep/2013:04:08:32 +0000] "PUT /v1/images/8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c/json HTTP/1.1" 401 194 "-" "go/go1.1.1 kernel/3.8.0-29-generic" "-"
pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d