From cc72411de48bd0885e5d1dd15de1a22b673277c6 Mon Sep 17 00:00:00 2001 From: mag37 Date: Wed, 1 Mar 2023 20:27:47 +0100 Subject: [PATCH] troubleshooting Created for troubleshooting, use if you suspect dockcheck screwed up with errors to easily review your running configs. Restart the faulty contianer manually from the compose-file! --- errorCheck.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 errorCheck.sh diff --git a/errorCheck.sh b/errorCheck.sh new file mode 100644 index 0000000..13c632a --- /dev/null +++ b/errorCheck.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +SearchName="$1" +for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do + echo "------------ $i ------------" + ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}') + [ -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}}') + + if [[ $ContConfigFile = '/'* ]] ; then + ComposeFile="$ContConfigFile" + else + ComposeFile="$ContPath/$ContConfigFile" + fi + + echo -e "Service name:\t\t$ContName" + echo -e "Project working dir:\t$ContPath" + echo -e "Compose files:\t\t$ComposeFile" + echo -e "Container image:\t$ContImage" + echo + echo "Mounts:" + docker inspect -f '{{ range .Mounts }}{{ .Source }}:{{ .Destination }}{{ printf "\n" }}{{ end }}' $i + echo +done