Skip to content

Instantly share code, notes, and snippets.

View a-pagano's full-sized avatar

Adriano Pagano a-pagano

  • Switzerland
View GitHub Profile
#!/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)