Skip to content

Instantly share code, notes, and snippets.

@Philmod
Created February 9, 2018 19:02
Show Gist options
  • Save Philmod/bf1e64643bdb20564e94370663a7e87b to your computer and use it in GitHub Desktop.
Save Philmod/bf1e64643bdb20564e94370663a7e87b to your computer and use it in GitHub Desktop.
Side container to keep track of docker stats during GCB build steps
steps:
# Run docker stats in the background.
# --no-stream is used in order to print the stats on different lines.
- name: 'gcr.io/cloud-builders/docker'
args:
- 'run'
- '-d'
- '--name=docker-stats'
- '--volume=/var/run/docker.sock:/var/run/docker.sock'
- '--entrypoint=/bin/bash'
- 'gcr.io/cloud-builders/docker'
- '-c'
- 'while true; do docker stats --no-stream; sleep 1; done'
# Simulate some CPU intensive step.
- name: 'ubuntu'
entrypoint: 'bash'
args:
- '-c'
- |
apt-get update
apt-get install -y stress
stress --cpu 1 --timeout 10
# Show logs from the docker stats command.
- name: 'gcr.io/cloud-builders/docker'
args: ['logs', 'docker-stats']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment