Skip to content

Instantly share code, notes, and snippets.

@kitwalker12
Last active January 26, 2016 23:36
Show Gist options
  • Select an option

  • Save kitwalker12/52291d6fb7c780dacfa2 to your computer and use it in GitHub Desktop.

Select an option

Save kitwalker12/52291d6fb7c780dacfa2 to your computer and use it in GitHub Desktop.
Docker Log test
FROM ubuntu:trusty
COPY ./entrypoint.sh /
COPY ./run.sh /
RUN chmod +x /entrypoint.sh
RUN chmod +x /run.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["start"]
#!/bin/bash
set -e
if [ "$1" = 'start' ]; then
trap "shutdown" SIGINT SIGTERM
shutdown() {
./run.sh | tee -a /logs/log.out
echo "Stopped" >> /logs/log.out
}
echo "Started" >> /logs/log.out
# while true; do echo hello world >> /logs/log.out; sleep 1; done
tail -f /var/log/bootstrap.log | tee -a /logs/log.out
else
"$@"
fi
docker build -t geetanjali .
docker run --volume $(pwd):/logs -it geetanjali
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment