2017-01-11 5 views
2

マイテラフォームのconfig.tf:上テラフォーム、画像を引くことはできません

provider "docker" { 
    host = "tcp://my_dockerhost:2376/" 
} 


resource "docker_container" "ubuntu" { 
    name = "foo" 
    image = "${docker_image.ubuntu.latest}" 
} 


resource "docker_image" "ubuntu" { 
    name = "ubuntu:precise" 
} 

Erorr適用されます。

docker_image.ubuntu: Creating... 
latest: "" => "<computed>" 
name: "" => "ubuntu:precise" 
Error applying plan: 

1 error(s) occurred: 

docker_image.ubuntu: **Unable to read Docker image into resource: Unable to find or pull image ubuntu:precise** 

私は私のシステムからすべての既存のローカルの画像を削除して、再度実行し、次にdocker imagesを実行しますが、イメージをプルしますが、applyコマンドで成功することができず、同じエラーが発生します。

+0

ほとんどの可能性はあなたのドッカー設定の問題です。ドッカーデーモンが動作していて、2376番のポートにtelnetで接続できるかどうか確認できますか?次に、最新のテラフォームを実行します。 – BMW

答えて

1

あなたの正確な設定を使用して、それは私にとって成功しました。下記の出力を参照してください。

docker_image.ubuntu: Refreshing state... (ID: sha256:5b117edd0b767986092e9f721ba23649...f53f1f41aff9dd1861c2d4feubuntu:precise) 
docker_container.ubuntu: Refreshing state... (ID: 0482ec57dadff257a64815b10ac1d97863844a16852af7326046bb2ce3c8de0a) 
aws_key_pair.mykey: Refreshing state... (ID: mykey) 
aws_instance.example: Refreshing state... (ID: i-054b71ec0f9fe55bb) 
docker_image.ubuntu: Creating... 
    latest: "" => "<computed>" 
    name: "" => "ubuntu:precise" 
docker_image.ubuntu: Creation complete (ID: sha256:5b117edd0b767986092e9f721ba23649...f53f1f41aff9dd1861c2d4feubuntu:precise) 
docker_container.ubuntu: Creating... 
    bridge:   "" => "<computed>" 
    gateway:   "" => "<computed>" 
    image:   "" => "sha256:5b117edd0b767986092e9f721ba2364951b0a271f53f1f41aff9dd1861c2d4fe" 
    ip_address:  "" => "<computed>" 
    ip_prefix_length: "" => "<computed>" 
    log_driver:  "" => "json-file" 
    must_run:   "" => "true" 
    name:    "" => "foo" 
    restart:   "" => "no" 
docker_container.ubuntu: Creation complete (ID: a069e59359f19902d75642c584746c70098ed4f76f04d4570ae53f2383774649) 

Apply complete! Resources: 2 added, 0 changed, 0 destroyed. 

The state of your infrastructure has been saved to the path 
below. This state is required to modify and destroy your 
infrastructure, so keep it safe. To inspect the complete state 
use the `terraform show` command. 

State path: 
関連する問題