LoginSignup
7
5

More than 3 years have passed since last update.

ConoHaでDocker Machineがうまく使えなかったのでなんとかした話

Last updated at Posted at 2017-01-24

概要(TL;DR)

docker-machine createでSSHが延々とコケ続けるときは、docker-machine provision マシン名を試せ

はじめに

ConoHaでDocker Machineを使うの記事を読んで、よっしゃ俺も使ったるで!と意気込んでやったものの、いろいろコケるコケる。
openstackドライバを経由して作成すると必ずSSHで死ぬので、ConoHaでインスタンスを手動で作ってdockerホストにしてからgenericドライバで接続なんていう、わりと不毛なことをやるしか方法はないのか、、、とずっと困っていたところでした。

やり方

詳しいやり方は上記記事に書いてありますが、改めて手順をおさらいします。

コントロールパネルのAPIから、以下の情報をコピーしておきます。

  • ユーザー名(APIユーザーのgcnuで始まるやつ) テナント名とは微妙に違うので注意
  • テナントID
  • APIパスワード
  • エンドポイントのURL(https://identity.tyo1.conoha.io/v2.0)
  • リージョン名(今回は東京なのでtyo1)

以下のような環境変数の形に成形。(私はコンテナを複数使う可能性があったのでdirenvを使って.envrcに登録しました!)

export OS_USERNAME=gncu00000000
export OS_TENANT_ID=XXXXXXXXXXXXXXXXXXXXXXX
export OS_PASSWORD=Password123!
export OS_AUTH_URL=https://identity.tyo1.conoha.io/v2.0
export OS_REGION_NAME=tyo1

.envrcを保存したディレクトリにて、docker-machineの以下コマンドを叩きました。
2017年1月現在のフレーバーリスト

docker-machine create -d openstack --openstack-flavor-name g-2gb  --openstack-image-name vmi-ubuntu-16.04-amd64-unified   --openstack-sec-groups "default,gncs-ipv4-all" test
$ docker-machine create -d openstack --openstack-flavor-name g-2gb  --openstack-image-name vmi-ubuntu-16.04-amd64-unified   --openstack-sec-groups "default,gncs-ipv4-all" test
Running pre-create checks...
Creating machine...
(test) Creating machine...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with ubuntu(systemd)...
Error creating machine: Error running provisioning: Something went wrong running an SSH command!
command : sudo apt-get update
err     : exit status 100
output  : E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

なんか出た!!!
何度やってもずっとこの状態が直らないのでいろいろ調査。

docker-machine provision test と実施したらうまくいった・・・・
長かった

7
5
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
7
5