2

我正在尝试构建和配置一个 docker 容器,但是当我运行它时,它会在运行配置脚本时挂起。

我正在使用以下命令在 OSX 上运行:

Boot2Docker-cli version: v1.3.1
Packer v0.7.2

**docker version**
Client version: 1.3.1
Client API version: 1.15
Server version: 1.3.1
Server API version: 1.15

运行这个:

packer build ./packer-build-templates/docker/testsite/testsite.json

packer-build-templates/docker/testsite/testsite.json

 {
          "builders": [
            {
              "type": "docker",
              "image": "centos:centos6",
              "commit": "true"
            }
          ],
          "provisioners": [

                        {
                          "type": "shell",
                          "script": "script.sh"
                        }
                ],


        "post-processors": [
                [
                    {
                        "type": "docker-tag",
                        "repository": "test/stuff",
                        "tag": "latest"
                    }
                ]
            ]



        }

脚本.sh

#!/bin/sh -x
echo foo

输出:

==> docker: Creating a temporary directory for sharing data...
==> docker: Pulling Docker image: centos:centos6
    docker: centos:centos6: The image you are pulling has been verified
    docker: Status: Image is up to date for centos:centos6
==> docker: Starting docker container...
    docker: Run command: docker run -v /var/folders/z2/nm_4_yyx2ss9z8wn4h0bfd1jw_pj8j/T/packer-docker208208953:/packer-files -d -i -t centos:centos6 /bin/bash
    docker: Container ID: 3ab21c7c21bc4af84e0f0c7bdbac91ee600d1ea0a469bfa51a959faba73fa7e4
==> docker: Provisioning with shell script: script.sh

这是它所能得到的。然后它就坐在那里。知道这里发生了什么吗?

4

0 回答 0