Answers for "get docker container id bash"

0

get docker container id bash

# The inspect command returns a json, so you can navigate it with
# that logic. 

docker inspect --format '{{.Id}}' [container_name | container_id]

# When you run this: 
docker inspect --format '{{.NetworkSettings.Networks}}' mysql
# You'll get:
map[bridge:0xc00011a000]

# This means it is an iterable, so:
docker inspect --format '{{range .NetworkSettings.Networks}} IP is: {{.IPAddress}} {{end}}' mysql

# Please notice Keyword range at the beginning and {{end}} at the end.
# Anything in between, even plain text, will be printed!
Posted by: Guest on July-23-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language