Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # details templates for docker images and containers
- read -r -d '' DOCKER_CONTAINER_STATUS_TEMPLATE <<'EOM'
- ===============================================
- Name: {{.Name}}
- Id: {{printf "%.12s" .Id}}
- Pid: {{.State.Pid}}
- Image ID: {{.Image}}
- Image Name: {{.Config.Image}}
- Hostname: {{.Config.Hostname}}
- MacAddress: {{.NetworkSettings.MacAddress}}
- IPAddress: {{.NetworkSettings.IPAddress}}
- Ports: {{range $k, $v := .NetworkSettings.Ports}}{{printf "\n%14s" ""}}{{printf "%s" $k}} -> {{json $v}}{{end}}
- Networks: {{range $k, $v := .NetworkSettings.Networks}}{{printf "\n%14s" ""}}{{printf "%s" $k}} -> Gateway:{{$v.Gateway}}, IPAddress:{{$v.IPAddress}}{{end}}
- Mounts: {{range $k, $v := .Mounts}}{{printf "\n%14s" ""}}{{$k}} -> {{json $v}}{{end}}
- Status: {{.State.Status}}
- Restarting: {{.State.Restarting}}
- RestartCount: {{.RestartCount}}
- StartedAt: {{.State.StartedAt}}
- FinishedAt: {{.State.FinishedAt}}
- ===============================================
- EOM
- read -r -d '' DOCKER_IMAGE_STATUS_TEMPLATE <<'EOM'
- ===============================================
- Id: {{printf "%.12s" .Id}}
- RepoTags: {{.RepoTags}}
- RepoDigests: {{.RepoDigests}}
- Size: {{printf "%s" .Size}}
- Created: {{.Created}}
- ===============================================
- EOM
- dkIinfo() {
- docker image inspect "$@" --format="${DOCKER_IMAGE_STATUS_TEMPLATE}"
- }
- dkCinfo() {
- docker container inspect "$@" --format="${DOCKER_CONTAINER_STATUS_TEMPLATE}"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement