Last active
March 10, 2017 14:14
-
-
Save esolitos/5fb61dc06b95995bf0aa45be4b7ea15c to your computer and use it in GitHub Desktop.
Help with Wodby, Datadog, Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Some helper commands | |
# Get the container id based on a pid child process | |
ps faux | grep -C10 $MY_PID | grep "docker-containerd-shim" | |
# Given a container name gets the APP_NAME | |
# For example: $MY_CONTAINER_NAME="k8s_web-backend.416e49d_web-backend-5f3qk_bb561cbf-f330-4188-be92-2ea9f607b71f_69f3bc6a-e240-11e6-ab50-5efaafd16bc4_8950f42d" | |
docker exec -ti $(docker inspect --format="{{.ID}}:{{.Name}}" $(docker ps -aq --no-trunc) | grep $MY_CONTAINER_NAME | cut -f1 -d':') /usr/bin/env | grep APP_NAME | |
# Simplified version | |
docker exec -ti $(docker ps --format="{{.ID}} {{.Names}}" | grep $MY_CONTAINER_NAME | awk '{print $1}') /usr/bin/env | grep APP_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment