2023-03-01 19:27:47 +00:00
|
|
|
#!/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"
|
2023-03-05 20:13:23 +00:00
|
|
|
echo -e "Environment files:\t$ContEnv"
|
2023-03-01 19:27:47 +00:00
|
|
|
echo -e "Container image:\t$ContImage"
|
|
|
|
echo
|
|
|
|
echo "Mounts:"
|
2023-03-05 20:13:23 +00:00
|
|
|
docker inspect -f '{{ range .Mounts }}{{ .Source }}:{{ .Destination }}{{ printf "\n" }}{{ end }}' "$i"
|
2023-03-01 19:27:47 +00:00
|
|
|
echo
|
|
|
|
done
|