2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GCE スタートアップスクリプトで gsutil を使う

2
Posted at

問題

GoogleComputeEngine(GCE) CoreOS では,gsutil などのツールは,google/cloud-sdk という docker イメージ内にあるものを利用している.しかし,これらが使えるようになるのはスタートアップスクリプト終了後になっているため,スタートアップスクリプト内で gsutil などを使うと command not found となる.

解決策

スタートアップスクリプト内で google/cloud-sdk を pull し,そこに含まれているコマンドを利用する.また,なぜか gcloud components update しろと警告が出るので,予めアップデートしておく.

$ docker pull google/cloud-sdk
$ docker run -t --name updating google/cloud-sdk /google-cloud-sdk/bin/gcloud components update -q
$ docker commit updating google/cloud-sdk:latest

その後,gsutil コマンドを利用する,

$ docker run -t --rm google/cloud-sdk /google-cloud-sdk/bin/gsutil cat <url> 
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?