When use multiple images the second one commands isn't accessible

I have this yml:

 jobs:
     deploy_to_staging:
         docker:
           - image: google / cloud-sdk
           - image: circleci / openjdk: 11-jdk

I have access to commands only from the first image, for example when the command gradle build runs it returns:

 / bin / bash: gradle: command not found

If I invert image order then I can access gradle commands but gcloud will not be found.

Does anyone know which is my mistake?

@felipeespitalher a similar situation has been addressed in this previous post

I would install the gcloud client in the circleci/openjdk:11-jdk image in the pipeline and eliminate the google/cloud-sdk image. Below is an example of how to do this:

curl -o gcp-cli.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz
tar -xzvf gcp-cli.tar.gz
echo ${GOOGLE_CLOUD_KEYS} | base64 --decode --ignore-garbage > ${HOME}/.ssh/cicd_demo_gcp_creds.json
./google-cloud-sdk/install.sh  --quiet
echo 'export PATH=$PATH:~/google-cloud-sdk/bin' >> $BASH_ENV
source $BASH_ENV
gcloud auth activate-service-account --key-file ${HOME}/.ssh/cicd_demo_gcp_creds.json

You could also use the gcloud CirlcleCI orbs to install the client as well.