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
kind: Namespace | |
apiVersion: v1 | |
metadata: | |
name: demo-ns | |
labels: | |
name: demo-ns | |
--- | |
kind: Pod | |
apiVersion: v1 | |
metadata: |
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/bash | |
PS3="Container to exec: " | |
IFS=$'\n' | |
OUTPUT=( $(docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.Status}}\t{{.Ports}}") ) | |
# if there will always be 1 line of output, even when to containers are running | |
if [[ $(wc -l <<< $"{OUTPUT}") -le 1 ]]; then | |
echo "No running containers found, exiting.." | |
exit 0 |