Why doesn't the docker alias work in the script? $ alias docker='podman' $…
- User
Why doesn't the docker alias work in the script?
$ alias docker='podman'
$ ./build-docker-image.sh
Building Docker image image-plus-audio:latest...
./build-docker-image.sh: line 13: docker: command not found
Assistant
The alias doesn't work in the script because aliases are not inherited by subshells or scripts by default. When you run
./build-docker-image.sh, it executes in a separate subshell where your interactive shell's aliases aren't available.Here are a few ways to fix this:
Option 1: Export as a function instead of an alias
bashdocker() { podman "$@"; } export -f docker
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.