You do not need the env.
prefix when using Bash – you refer to the environment variable directly:
docker build --build-arg aws_access=${AWS_ACCESS_KEY_ID}
Bash variables are vastly different from Jenkins ones, and what’s more, with your Jenkins script, the shell doesn’t see those “variables”, as Jenkins has already substituted them for the values.
CLICK HERE to find out more related problems solutions.