Skip to content

Instantly share code, notes, and snippets.

@rafex
Created March 27, 2024 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafex/5e85134431adb745e6a8de67d61c094d to your computer and use it in GitHub Desktop.
Save rafex/5e85134431adb745e6a8de67d61c094d to your computer and use it in GitHub Desktop.
"This is a small script that validates the existence of the 'docker' or 'podman' command to be used."
#!/bin/sh
# This script is used to check if the podman or docker command is available
# Author: @rafex (Raúl González)
pods_manager_command_name="docker"
function valid_podman() {
if ! pods_manager_loc="$(type -p "$pods_manager_command_name")" || [[ -z $pods_manager_loc ]]; then
echo "$pods_manager_command_name not found, trying with podman"
pods_manager_command_name="podman"
alias docker=podman
return 0
fi
}
valid_podman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment