mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-19 02:47:45 +00:00
changed to jq metadata check
This commit is contained in:
@@ -2,12 +2,21 @@
|
|||||||
SearchName="$1"
|
SearchName="$1"
|
||||||
for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
|
for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
|
||||||
echo "------------ $i ------------"
|
echo "------------ $i ------------"
|
||||||
ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}')
|
ContLabels=$(docker inspect "$i" --format '{{json .Config.Labels}}')
|
||||||
[ -z "$ContPath" ] && { "$i has no compose labels - skipping" ; continue ; }
|
|
||||||
ContConfigFile=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.config_files" }}')
|
|
||||||
ContName=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.service" }}')
|
|
||||||
ContEnv=$(docker inspect "$i" --format '{{index .Config.Labels "com.docker.compose.project.environment_file" }}')
|
|
||||||
ContImage=$(docker inspect "$i" --format='{{.Config.Image}}')
|
ContImage=$(docker inspect "$i" --format='{{.Config.Image}}')
|
||||||
|
ContPath=$(jq -r '."com.docker.compose.project.working_dir"' <<< "$ContLabels")
|
||||||
|
[ "$ContPath" == "null" ] && ContPath=""
|
||||||
|
[ -z "$ContPath" ] && { "$i has no compose labels - skipping" ; continue ; }
|
||||||
|
ContConfigFile=$(jq -r '."com.docker.compose.project.config_files"' <<< "$ContLabels")
|
||||||
|
[ "$ContConfigFile" == "null" ] && ContConfigFile=""
|
||||||
|
ContName=$(jq -r '."com.docker.compose.service"' <<< "$ContLabels")
|
||||||
|
[ "$ContName" == "null" ] && ContName=""
|
||||||
|
ContEnv=$(jq -r '."com.docker.compose.project.environment_file"' <<< "$ContLabels")
|
||||||
|
[ "$ContEnv" == "null" ] && ContEnv=""
|
||||||
|
ContUpdateLabel=$(jq -r '."mag37.dockcheck.update"' <<< "$ContLabels")
|
||||||
|
[ "$ContUpdateLabel" == "null" ] && ContUpdateLabel=""
|
||||||
|
ContRestartStack=$(jq -r '."mag37.dockcheck.restart-stack"' <<< "$ContLabels")
|
||||||
|
[ "$ContRestartStack" == "null" ] && ContRestartStack=""
|
||||||
|
|
||||||
if [[ $ContConfigFile = '/'* ]] ; then
|
if [[ $ContConfigFile = '/'* ]] ; then
|
||||||
ComposeFile="$ContConfigFile"
|
ComposeFile="$ContConfigFile"
|
||||||
@@ -20,6 +29,8 @@ for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
|
|||||||
echo -e "Compose files:\t\t$ComposeFile"
|
echo -e "Compose files:\t\t$ComposeFile"
|
||||||
echo -e "Environment files:\t$ContEnv"
|
echo -e "Environment files:\t$ContEnv"
|
||||||
echo -e "Container image:\t$ContImage"
|
echo -e "Container image:\t$ContImage"
|
||||||
|
echo -e "Update label:\t$ContUpdateLabel"
|
||||||
|
echo -e "Restart Stack label:\t$ContRestartStack"
|
||||||
echo
|
echo
|
||||||
echo "Mounts:"
|
echo "Mounts:"
|
||||||
docker inspect -f '{{ range .Mounts }}{{ .Source }}:{{ .Destination }}{{ printf "\n" }}{{ end }}' "$i"
|
docker inspect -f '{{ range .Mounts }}{{ .Source }}:{{ .Destination }}{{ printf "\n" }}{{ end }}' "$i"
|
||||||
|
|||||||
Reference in New Issue
Block a user