Skip to content

Commit

Permalink
Added function to get docker container ip
Browse files Browse the repository at this point in the history
  • Loading branch information
missingcharacter committed Jul 8, 2024
1 parent 413681b commit b33f354
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,24 @@ function cleandockervolumes() {
"${docker_cmds[@]}" volume ls -f dangling=true -q | xargs "${docker_cmds[@]}" volume rm
}

function dockerip() {
local container_name_or_id="${1}"
declare -a docker_cmds=()
case "$(uname)" in
Darwin)
docker_cmds+=('docker')
;;
Linux)
docker_cmds+=('sudo' 'docker')
;;
*)
msg_error "Operating System $(uname) is not supported"
;;
esac
"${docker_cmds[@]}" inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "${container_name_or_id}"
}


function base64encodestring() {
local TEXT="${1}"
declare -a base64_cmds=()
Expand Down

0 comments on commit b33f354

Please sign in to comment.