Skip to content

Instantly share code, notes, and snippets.

@dqminh
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dqminh/0b529e7ab77183962f8a to your computer and use it in GitHub Desktop.
Save dqminh/0b529e7ab77183962f8a to your computer and use it in GitHub Desktop.
7600-zombie dockerfiles
docker build -t 7600-zombie .
# for original script
docker run --privileged -it 7600-zombie

# original script, except that we removed the extra start step
# this doesnt seem to exhibit the problem
docker run --privileged -it 7600-zombiedocker run --privileged -it 7600-zombie /app/run.sh without-start.coffee
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
ADD . /app
RUN chmod +x /app/run.sh
WORKDIR /app
RUN /nodejs/bin/npm install coffee-script dockerode
CMD /app/run.sh main.coffee
docker = new (require('dockerode'))(socketPath: '/var/run/docker.sock')
ACTIONS = ['start', 'kill', 'remove']
LIMIT = 100
completed = 0
createContainer = ->
docker.createContainer {
Cmd: '/bin/sh'
Image: 'busybox:latest'
OpenStdin: true
Tty: true
}, (err, container) ->
return if err
container.attach {stream: true, stdin: true, stdout: true}, (err, ttyStream) ->
return if err || !ttyStream
for action in ACTIONS
console.log "#{container.id} starting #{action}"
container[action] ->
console.log "#{container.id} finished #{action}"
completed += 1
if completed == LIMIT
process.exit(0)
createContainer() for [1..LIMIT]
#!/bin/bash
# start docker
docker -d -D &
echo "waiting for docker to start"
sleep 1
echo "pulling busybox"
docker pull busybox:latest
node_modules/.bin/coffee $1
# print out the proccess hierrachy
ps auxf
docker = new (require('dockerode'))(socketPath: '/var/run/docker.sock')
LIMIT = 100
ACTIONS = ['kill', 'remove']
completed = 0
createContainer = ->
docker.createContainer {
Cmd: '/bin/sh'
Image: 'busybox:latest'
OpenStdin: true
Tty: true
}, (err, container) ->
return if err
container.attach {stream: true, stdin: true, stdout: true}, (err, ttyStream) ->
return if err || !ttyStream
for action in ACTIONS
console.log "#{container.id} starting #{action}"
container[action] ->
console.log "#{container.id} finished #{action}"
completed += 1
if completed == LIMIT
process.exit(0)
createContainer() for [1..LIMIT]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment