Useful Docker commands
Show all the files in a docker volume, use: docker-list-volume-contents volume_name
function docker-list-volume-contents() {
docker run --rm -v ${1}:/data -it alpine find /data -type f
}
Output the entrypoint content if it exists: docker-show-entrypoint-contents image_name
function docker-show-entrypoint-contents() {
local image_name=$1
local entrypoint=$(docker inspect --format='{{json .Config.Entrypoint}}' "$image_name")
if [ -z "$entrypoint" ] || [ "$entrypoint" = "null" ]; then
echo "Entrypoint: Not found"
else
local entrypoint_script=$(echo "$entrypoint" | jq -r '.[]' | base64 --decode)
echo "Entrypoint:"
echo "$entrypoint_script"
fi
}