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
#!/usr/bin/env bash | |
# Put these functions into your ~/.bashrc | |
# Then source ~/.bashrc | |
# USAGE: get-docker-container-id pattern | |
# DESCRIPTION: This function takes as parameter an image name (or partial image name) and prints out the associated container hash if any | |
# EXAMPLE: get-docker-container-id ubuntu --> c3a364dd56df | |
function get-docker-container-id(){ | |
targetcontainer=$(docker ps |awk "/$1/" | tail -1) |