Skip to content

Instantly share code, notes, and snippets.

@apatil
Created October 31, 2013 20:15
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 apatil/7256305 to your computer and use it in GitHub Desktop.
Save apatil/7256305 to your computer and use it in GitHub Desktop.
Reproduction of Docker issue
#!/bin/bash
# I ran this on an EC2 c1.medium instance with Docker version 0.6.3 on Ubuntu 12.04.
# I ran docker -d on tcp port 4243, and delivered 'stop' via the rest api
# because that's what I do in my production setup, but I don't know if that
# makes a difference.
# First, run ubuntu:12.04, and in it do
# echo -e '#!/bin/bash\nsleep 600' > cmd.sh
# chmod +x cmd.sh
# Then commit it and tag it as img-with-cmd
dockerCmd="docker -H 127.0.0.1:4243"
runCmd="$dockerCmd run -d img-with-cmd ./cmd.sh"
while [[ 1 ]]
do
ctrId=$($runCmd)
ctrRoute="http://127.0.0.1:4243/containers/$ctrId"
stopCmd="curl -s -X POST $ctrRoute/stop"
waitCmd="curl -s -X POST $ctrRoute/wait"
delCmd="curl -s -X DELETE $ctrRoute"
logCmd="$dockerCmd logs $ctrId"
sleep 1
echo "stopping"
echo $($stopCmd)
#echo "logs"
#echo $($logCmd)
echo "status"
echo $($waitCmd)
$deleteCmd
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment