Skip to content

Instantly share code, notes, and snippets.

Last active April 5, 2023 14:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Docker command and utils.

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"
      local entrypoint_script=$(echo "$entrypoint" | jq -r '.[]' | base64 --decode)
      echo "Entrypoint:"
      echo "$entrypoint_script"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment