Pull private docker images from Google Container Registry w/o gcloud -
i'm using shippable push private docker images google container registry want pull either locally on laptop, or inside instance on google compute engine.
i know command gcloud preview docker pull gcr.io/projectid/image-name
works, can't rely on gcloud being installed on every machine may need pull image from.
if run docker-compose -d
on machine following error:
pulling image gcr.io/projectid/image-name... pulling repository gcr.io/projectid/image-name traceback (most recent call last): file "<string>", line 3, in <module> file "/compose/build/docker-compose/out00-pyz.pyz/compose.cli.main", line 31, in main file "/compose/build/docker-compose/out00-pyz.pyz/compose.cli.docopt_command", line 21, in sys_dispatch file "/compose/build/docker-compose/out00-pyz.pyz/compose.cli.command", line 27, in dispatch file "/compose/build/docker-compose/out00-pyz.pyz/compose.cli.docopt_command", line 24, in dispatch file "/compose/build/docker-compose/out00-pyz.pyz/compose.cli.command", line 59, in perform_command file "/compose/build/docker-compose/out00-pyz.pyz/compose.cli.main", line 464, in file "/compose/build/docker-compose/out00-pyz.pyz/compose.project", line 208, in file "/compose/build/docker-compose/out00-pyz.pyz/compose.service", line 214, in recreate_containers file "/compose/build/docker-compose/out00-pyz.pyz/compose.service", line 199, in create_container file "/compose/build/docker-compose/out00-pyz.pyz/compose.progress_stream", line 37, in stream_output file "/compose/build/docker-compose/out00-pyz.pyz/compose.progress_stream", line 50, in print_output_event compose.progress_stream.streamoutputerror: error: status 403 trying pull repository projectid/image-name: "access denied."
is there way authenticate or access image form of oauth or keys? want avoid having install gcloud on every machine ever need pull image, , images have remain private.
i have tried gcloud preview docker -a
not solution i'm looking for.
thank in advance help.
if want work google container registry on machine not in google compute engine (i.e. local) using vanilla docker can follow google's instructions.
the 2 main methods using access token or json key file.
note _token
, _json_key
actual values provide username (-u
)
access token
$ docker login -e 1234@5678.com -u _token -p "$(gcloud auth print-access-token)" https://gcr.io
json key file
$ docker login -e 1234@5678.com -u _json_key -p "$(cat keyfile.json)" https://gcr.io
to create key file can follow these instructions:
- open credentials page.
- to set new service account, following:
- click add credentials > service account.
- choose whether download service account's public/private key standard p12 file, or json file can loaded google api client library.
- your new public/private key pair generated , downloaded machine; serves copy of key. responsible storing securely.
you can view google's documentation on generating key file here.
Comments
Post a Comment