Skip to content

Instantly share code, notes, and snippets.

@jotson
Last active August 29, 2015 14:09
Show Gist options
  • Save jotson/87c1bba650024bd8512b to your computer and use it in GitHub Desktop.
Save jotson/87c1bba650024bd8512b to your computer and use it in GitHub Desktop.
Bash script to start dev container and cleanup after
#!/bin/bash
# Start a container
# jotson/webdev runs supervisord so this command waits until Ctrl+C
sudo docker run -p 80:80 jotson/webdev $*
# Delete container
echo "Cleaning up container..."
sudo docker rm $(sudo docker ps -a | grep 'webdev.*Exited.*second.*ago' | awk '{ print $1 }')
echo "Webdev finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment