Terraform准备启动jenkins容器?

时间:2016-04-11 05:36:14

标签: terraform

我试图使用terraform实现一个非常简单的基于配置的jenkins图像拉动(通过docker hub),然后启动图像。这是我在这个场景中唯一想要的东西,不过这个配置文件......

# Start a container
resource "docker_container" "jenkins" {
  name = "jenkins_tf_server"
  image = "${docker_image.jenkins.latest}"
  command = ["docker run -p 8080:8080 -p 50000:50000 -v /jenkins:/var/jenkins_home -d jenkins"]
}

# Find the latest Ubuntu precise image.
resource "docker_image" "jenkins" {
  name = "jenkins"
}

......我遇到了似乎有两种奇怪的情况。

第一个是Terraform,执行terraform apply时只需完成这么多工作并挂起......

$ terraform apply
docker_image.ubuntu: Refreshing state... (ID: )
docker_image.jenkins: Creating...
  latest: "" => "<computed>"
  name:   "" => "jenkins"

我一开始的想法是因为它下载了一些荒谬的詹金斯图像。我在大约15分钟后检查过,并使用docker images

找到了以下内容
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              precise             e1917e6028b6        6 days ago          138.4 MB
adron/dock-base     latest              19322f24adb5        3 weeks ago         417.1 MB
jenkins             1.596.2             b89edf070767        11 months ago       662 MB
jenkins             1.596.1             10929b1bd6c1        12 months ago       662 MB
jenkins             1.596               484633fa05c1        15 months ago       661.7 MB
jenkins             1.595               218ccb377abc        15 months ago       661.7 MB
jenkins             1.594               a0e66c091a65        15 months ago       661.7 MB
jenkins             1.593               d1a051ab9181        15 months ago       661.7 MB
jenkins             1.580.2             a1760aac28b5        15 months ago       661.5 MB
jenkins             1.592               5b1c9d13e15f        15 months ago       661.7 MB
jenkins             1.591               1ed19954eb17        15 months ago       661.7 MB
jenkins             1.590               32a506f5f209        15 months ago       661.7 MB
jenkins             1.589               03046b8487c8        15 months ago       661.7 MB
jenkins             1.588               4808c4dcd370        15 months ago       661.7 MB
jenkins             1.587               46e316ce7c55        15 months ago       661.7 MB
jenkins             1.586               564cf586884f        15 months ago       661.5 MB
jenkins             1.585               095470f5ded4        15 months ago       661.4 MB
jenkins             1.584               4ce45cf2ba35        15 months ago       661.4 MB
jenkins             1.583               c247e6c41208        15 months ago       661.4 MB
jenkins             1.582               1db2820094fc        15 months ago       661.3 MB
jenkins             1.581               89a7e4784544        15 months ago       661.3 MB
jenkins             1.580               96c035d55481        15 months ago       661.3 MB
jenkins             1.580.1             d0580748a09e        15 months ago       661.5 MB
jenkins             1.579               d25e714f32ca        15 months ago       661.3 MB
jenkins             1.578               f27551f8a09e        15 months ago       661.3 MB
jenkins             1.577               08f7a353bb4b        15 months ago       661.3 MB
jenkins             1.576               7a0b44cc2593        15 months ago       661.4 MB
jenkins             1.575               4c4d8a34c3e9        15 months ago       661.4 MB
jenkins             1.574               5594009b4711        15 months ago       661.4 MB
jenkins             1.573               0cb884316533        15 months ago       661.4 MB
jenkins             1.572               be6b4f62a56d        15 months ago       661.3 MB
jenkins             1.571               550ab6938ec7        15 months ago       661.3 MB
jenkins             1.570               5deaae34589f        15 months ago       661.3 MB
jenkins             1.569               a02a7a601061        15 months ago       661.3 MB
jenkins             1.568               d7962fb8c99d        15 months ago       661.3 MB
jenkins             1.567               5076e78cad90        15 months ago       661.6 MB
jenkins             1.566               92a0fc7edfde        15 months ago       661.6 MB
jenkins             1.565               9ac08ed3d170        15 months ago       661.6 MB
jenkins             1.565.3             f32746929b80        15 months ago       661.4 MB
jenkins             1.565.2             7fcc53e58943        15 months ago       661.6 MB
jenkins             1.565.1             f2bf74880f3f        15 months ago       661.6 MB
jenkins             1.564               52abe54f3761        15 months ago       661.6 MB
jenkins             1.563               5dc5fa40c284        15 months ago       661.6 MB
jenkins             1.562               10281098ecaf        15 months ago       661.6 MB
jenkins             1.561               0041414dfbce        15 months ago       661.6 MB
jenkins             1.560               5a0403999187        15 months ago       661.4 MB
jenkins             1.559               f2794ccd4e2d        15 months ago       661 MB
jenkins             1.558               2ef2f3c7344c        15 months ago       660.9 MB
jenkins             1.557               4eca249661ab        15 months ago       660.8 MB
jenkins             1.556               7721817b7521        15 months ago       660.8 MB
jenkins             1.555               30da00a4e34e        15 months ago       660.7 MB
jenkins             1.554.3             37c6c23e2279        15 months ago       661.1 MB
jenkins             1.554.2             eda292ef5358        15 months ago       661.1 MB
jenkins             1.554.1             c00816fce587        15 months ago       660.9 MB
jenkins             1.554               c0ee99758afa        20 months ago       748.8 MB

我不知道究竟是什么样的地形已经消失并决定这样做。有关如何使其表现的任何想法,只需使用上面在terraform文件中列出的command参数中的docker命令启动图像?

0 个答案:

没有答案