How to add GCP IAM roles to Service Account

Viewed 2436

I am trying to create a docker swarm node on a VM instance on GCP using docker-machine.

docker-machine create swarm-node -d google --google-machine-type e2-standard-2 --google-zone europe-north1-a --google-project myproject-name

I use a GCP Service Account in localhost docker-machine CLI.

export GOOGLE_APPLICATION_CREDENTIALS="/home/my-name-here/.gcp/path-to-my-service-account-keyfile.json"

But I got this error:

Error with pre-create check: "Project with ID \"myproject-name\" not found. googleapi: Error 403: Required 'compute.projects.get' permission for 'projects/myproject-name', forbidden"

How can I add compute.projects.get GCP IAM access to the GCP Service Account?

1 Answers
Related