Packer: Shell scripts broken with Docker 1.4.x

Created on 12 Dec 2014  ·  85Comments  ·  Source: hashicorp/packer

Using the current source version of packer

Working scenario using docker 1.3.3:

2014/12/12 15:49:51 packer-builder-docker: 2014/12/12 15:49:51 Running the provision hook
1418399391,,ui,message,    docker: Container ID: b0117b8cbffd154539242acb24666f703b78ff22ef782e0d03cc768ba38db982
2014/12/12 15:49:51 packer-provisioner-shell: 2014/12/12 15:49:51 Opening /tmp/packer-shell648686173 for reading
2014/12/12 15:49:51 packer-provisioner-shell: 2014/12/12 15:49:51 [INFO] 109 bytes written for 'uploadData'
2014/12/12 15:49:51 [INFO] 109 bytes written for 'uploadData'
2014/12/12 15:49:51 packer-builder-docker: 2014/12/12 15:49:51 Executing in container b0117b8cbffd154539242acb24666f703b78ff22ef782e0d03cc768ba38db982: "(cp /packer-files/upload080199707 /tmp/script.sh) >/packer-files/cmd466238654 2>&1; echo $? >/packer-files/cmd466238654-exit"
1418399391,,ui,say,==> docker: Provisioning with shell script: /tmp/packer-shell648686173
2014/12/12 15:49:53 packer-builder-docker: 2014/12/12 15:49:53 Waiting for exit code to appear for remote command...
2014/12/12 15:49:53 packer-builder-docker: 2014/12/12 15:49:53 Executed command exit status: 0
2014/12/12 15:49:55 packer-builder-docker: 2014/12/12 15:49:55 Executing in container b0117b8cbffd154539242acb24666f703b78ff22ef782e0d03cc768ba38db982: "(chmod 0777 /tmp/script.sh) >/packer-files/cmd678804741 2>&1; echo $? >/packer-files/cmd678804741-exit"
2014/12/12 15:49:57 packer-builder-docker: 2014/12/12 15:49:57 Waiting for exit code to appear for remote command...
2014/12/12 15:49:57 packer-builder-docker: 2014/12/12 15:49:57 Executed command exit status: 0
2014/12/12 15:49:59 packer-builder-docker: 2014/12/12 15:49:59 [INFO] RPC endpoint: Communicator ended with: 0
2014/12/12 15:49:59 [INFO] RPC client: Communicator ended with: 0
2014/12/12 15:49:59 [INFO] RPC endpoint: Communicator ended with: 0
2014/12/12 15:49:59 packer-provisioner-shell: 2014/12/12 15:49:59 [INFO] RPC client: Communicator ended with: 0
2014/12/12 15:49:59 packer-builder-docker: 2014/12/12 15:49:59 Executing in container b0117b8cbffd154539242acb24666f703b78ff22ef782e0d03cc768ba38db982: "(chmod +x /tmp/script.sh; PACKER_BUILD_NAME='docker' PACKER_BUILDER_TYPE='docker' /tmp/script.sh) >/packer-files/cmd838923936 2>&1; echo $? >/packer-files/cmd838923936-exit"
2014/12/12 15:50:01 packer-builder-docker: 2014/12/12 15:50:01 Waiting for exit code to appear for remote command...
2014/12/12 15:50:02 packer-builder-docker: 2014/12/12 15:50:02 Executed command exit status: 127
2014/12/12 15:50:03 packer-builder-docker: 2014/12/12 15:50:03 [INFO] RPC endpoint: Communicator ended with: 127
2014/12/12 15:50:03 [INFO] 0 bytes written for 'stderr'
2014/12/12 15:50:03 [INFO] RPC client: Communicator ended with: 127
2014/12/12 15:50:03 [INFO] 0 bytes written for 'stdout'
2014/12/12 15:50:03 [INFO] RPC endpoint: Communicator ended with: 127
2014/12/12 15:50:03 packer-provisioner-shell: 2014/12/12 15:50:03 [INFO] 0 bytes written for 'stderr'
2014/12/12 15:50:03 packer-provisioner-shell: 2014/12/12 15:50:03 [INFO] RPC client: Communicator ended with: 127
2014/12/12 15:50:03 packer-provisioner-shell: 2014/12/12 15:50:03 [INFO] 0 bytes written for 'stdout'

Failing scenario using docker 1.4:

1418398765,,ui,say,==> docker: Provisioning with shell script: /tmp/packer-shell348099556
2014/12/12 15:39:25 packer-provisioner-shell: 2014/12/12 15:39:25 Opening /tmp/packer-shell348099556 for reading
2014/12/12 15:39:25 packer-provisioner-shell: 2014/12/12 15:39:25 [INFO] 109 bytes written for 'uploadData'
2014/12/12 15:39:25 [INFO] 109 bytes written for 'uploadData'
2014/12/12 15:39:25 packer-builder-docker: 2014/12/12 15:39:25 Executing in container ff13b288d87f7fa9d3c1e5ffeb810cc8fec6be80b1bd8eab21cc39a8e2b22336: "(cp /packer-files/upload431013147 /tmp/script.sh) >/packer-files/cmd669791166 2>&1; echo $? >/packer-files/cmd669791166-exit"
2014/12/12 15:39:27 packer-provisioner-shell: 2014/12/12 15:39:27 Retryable error: Error uploading script: Upload failed with non-zero exit status: 1
2014/12/12 15:39:29 packer-provisioner-shell: 2014/12/12 15:39:29 [INFO] 109 bytes written for 'uploadData'
2014/12/12 15:39:29 [INFO] 109 bytes written for 'uploadData'
2014/12/12 15:39:29 packer-builder-docker: 2014/12/12 15:39:29 Executing in container ff13b288d87f7fa9d3c1e5ffeb810cc8fec6be80b1bd8eab21cc39a8e2b22336: "(cp /packer-files/upload047296517 /tmp/script.sh) >/packer-files/cmd706862496 2>&1; echo $? >/packer-files/cmd706862496-exit"
2014/12/12 15:39:31 packer-provisioner-shell: 2014/12/12 15:39:31 Retryable error: Error uploading script: Upload failed with non-zero exit status: 1
2014/12/12 15:39:33 packer-provisioner-shell: 2014/12/12 15:39:33 [INFO] 109 bytes written for 'uploadData'
2014/12/12 15:39:33 [INFO] 109 bytes written for 'uploadData'
2014/12/12 15:39:33 packer-builder-docker: 2014/12/12 15:39:33 Executing in container ff13b288d87f7fa9d3c1e5ffeb810cc8fec6be80b1bd8eab21cc39a8e2b22336: "(cp /packer-files/upload033689215 /tmp/script.sh) >/packer-files/cmd209553362 2>&1; echo $? >/packer-files/cmd209553362-exit"
2014/12/12 15:39:35 packer-provisioner-shell: 2014/12/12 15:39:35 Retryable error: Error uploading script: Upload failed with non-zero exit status: 1
2014/12/12 15:39:37 packer-provisioner-shell: 2014/12/12 15:39:37 [INFO] 109 bytes written for 'uploadData'
2014/12/12 15:39:37 [INFO] 109 bytes written for 'uploadData'
2014/12/12 15:39:37 packer-builder-docker: 2014/12/12 15:39:37 Executing in container ff13b288d87f7fa9d3c1e5ffeb810cc8fec6be80b1bd8eab21cc39a8e2b22336: "(cp /packer-files/upload479277833 /tmp/script.sh) >/packer-files/cmd622516948 2>&1; echo $? >/packer-files/cmd622516948-exit"
2014/12/12 15:39:39 packer-provisioner-shell: 2014/12/12 15:39:39 Retryable error: Error uploading script: Upload failed with non-zero exit status: 1
2014/12/12 15:39:41 packer-provisioner-shell: 2014/12/12 15:39:41 [INFO] 109 bytes written for 'uploadData'
bug buildedocker

Most helpful comment

This for me is only happening when packer is running inside of docker and then trying to provision a new docker. Maybe this is doing it wrong?

All 85 comments

Just a followup.. when this was failing, it was using docker 1.4.0 from the latest docker repos. I just got it to work with this modified Vagrantfile:

Vagrant.configure("2") do |config|
  #config.vm.box = "phusion-open-ubuntu-14.04-amd64"
  #config.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box"
  config.vm.box = "ubuntu"

  config.vm.provider :virtualbox do |vb|
    vb.name = 'packer-builder'
    vb.customize ["modifyvm", :id, "--memory", "2048" ]
    vb.customize ["modifyvm", :id, "--cpus",  "2" ]
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end

  if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty?
    pkg_cmd = ""
    #pkg_cmd << "wget -q -O - https://get.docker.io/gpg | apt-key add -; "
    #pkg_cmd << "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list;"
    pkg_cmd << "apt-get update -qq; apt-get install -q -y --force-yes docker.io bsdtar; "
    pkg_cmd << "usermod -a -G docker vagrant; "
    pkg_cmd << "cd /usr/bin; wget -qO- https://dl.bintray.com/mitchellh/packer/packer_0.7.5_linux_amd64.zip | bsdtar -pxvf-; "
    pkg_cmd << "sudo chmod +x /usr/bin/packer*; "
    config.vm.provision :shell, :inline => pkg_cmd
  end
end

This installs Docker 1.0.1 ... and it works perfectly with the same Packer files.

Working Docker Version:

Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a

Non-Working:

Client version: 1.4.0
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 4595d4f
OS/Arch (client): linux/amd64
Server version: 1.4.0
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 4595d4f

Ok final update for the night ... it looks like Docker 1.4.0 is the issue. Docker 1.3.3 works fine:

Client version: 1.3.3
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): d344625
OS/Arch (client): linux/amd64
Server version: 1.3.3
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): d344625

it looks like Docker 1.4.0 is the issue. Docker 1.3.3 works fine:

Yup, that's the conclusion I came up with too

Confirmed that this is still a problem when using Docker 1.4.1

json file that recreates the problem:

{
  "builders": [
    {
      "type": "docker",
      "image": "ubuntu:latest",
      "pull": true,
      "export_path": "docker-burn.tar"
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "set -x",
        "set -e",
        "date"
      ]
    }
  ]
}

:+1: same here!

A naive fix would look like this:

https://github.com/mariussturm/packer/commit/3a286ab6bdba7b8e5bf6a43c357a0ffeacd3dc97

This breaks backwards compatibility with Docker 1.3- (what is ok imo)

@mariussturm Thanks for 3a286ab6bdba7b8e5bf6a43c357a0ffeacd3dc97. There is a related problem with the chef-solo provisioner; the first command it runs (creating the staging_directory) kills the container, thus ending the build. Your solution resolves that as well.

I also can confirm this problem with Docker 1.4.1

I am having the same issue (reported here when using inline) also when using the script element.
So essentially right now it is impossible to build docker v1.4.x images with packer with any of the shell provisioners.

The error is:

2014/12/25 12:21:30 packer-builder-docker: 2014/12/25 12:21:30 Executing in container 600d9cc40feaa99ee3f6b9ad6daf440dc79265abbbfa8676a45904463df1a353: "(cp /packer-files/upload674827840 /tmp/script.sh) >/packer-files/cmd940924575 2>&1; echo $? >/packer-files/cmd940924575-exit"
==> docker: Provisioning with shell script: /home/dl/testsourcedir/hello.sh
2014/12/25 12:21:32 packer-provisioner-shell: 2014/12/25 12:21:32 Retryable error: Error uploading script: Upload failed with non-zero exit status: 1

With a provisioner configuration like:

 "provisioners" : [
    {
        "type" : "shell",
        "script" : "{{pwd}}/testsourcedir/hello.sh"
    }
    ],

and a corresponding simple shell script:

[dl@localhost ~]$ cat testsourcedir/hello.sh
#!/bin/sh
echo "Hello"

+1, with the script variant of the shell provisioner.

+1
This provisioner has failed for me with the inline variant of the shell provisioner.

packer version
Packer v0.7.5
...
docker --version
Docker version 1.4.1, build 5bc2ff8

Based on the comments above (and the commit by @mariussturm) I built a virtual box box that you can use with boot2docker and it has marius' change baked into packer provided. This required the source to packer and @mitchellh's Vagrantfile for packer (hacked to build a 32 bit binary) as well @YungSang's source code for how to build a vagrant box from boot2docker's iso. Open source to the rescue!

Hope this helps some folks who want to use docker 1.4.1 with packer inside a vagrant.

https://atlas.hashicorp.com/iansmith/boxes/boot2docker-plus-packer

Urgh! Just ran into this one. Serious wrench in the gears for my project.

I also ran into this issue. What is the current workaround? Downgrade docker to 1.3.3?

I had to downgrade docker to 1.3.3. That's my current workaround.

@vitorcoxta and @yanaga Alternatively you can rebuilt a packer binary version of your own using the fix proposed by mariussturm:

https://github.com/mitchellh/packer/commit/3a286ab6bdba7b8e5bf6a43c357a0ffeacd3dc97

With the new docker 1.5, it seems unfortunate we still have to use 1.3.3 due to this bug :/

Any ETA on getting this rolled into a new release? 0.76, maybe?

:+1:

Having this issue with:

Docker version 1.5.0, build a8a31ef
Packer v0.7.5
Boot2Docker-cli version: v1.5.0
Git commit: ccd9032

Darwin 13.4.0 Darwin Kernel Version 13.4.0: Wed Dec 17 19:05:52 PST 2014; root:xnu-2422.115.10~1/RELEASE_X86_64 x86_64

I've created a github repo , https://github.com/stefancocora/packer-issue1752-fix , that contains packer binaries (amd64) built against the master branch with mariussturm fix for this issue.
You can use the binaries I've built up to the point when the packer maintainers merge the fix for this issue and release a new version.
The binaries I've built work flawlesly for me, I've added a way to test them in the aformentioned github repo, see README.md

@stefancocora thanks a lot for the repository! I can confirm that that version works (on Fedora 21/x86_64, with docker 1.5.0).

One thing I noticed with the use of exec instead of attach: it would be nice to also use the -t flag, so that a tty is allocated, and tools like sudo work (CentOS by default has Defaults requiretty in /etc/sudoers).

Thanks for testing @ankon , good point about -t , didn't think about it.
I've just created a packer binary compiled for docker with the -t flag.
Unfortunately it fails to build an image and I don't know what is causing that failure.
Reverting packer to the patch without -t I get a successful docker image build.

Error output from packer build with -t

...
    docker: Status: Image is up to date for devopsil/puppet:latest
==> docker: Starting docker container...
    docker: Run command: docker run -v /tmp/packer-docker141026721:/packer-files -d -i -t devopsil/puppet /bin/bash
    docker: Container ID: 72e09e8c029a7321143cac4baf012525e1a816e35770a1cc216327005caf1912
==> docker: Uploading ./modules => /tmp/modules
==> docker: Killing the container: 72e09e8c029a7321143cac4baf012525e1a816e35770a1cc216327005caf1912
Build 'docker' errored: Upload failed with non-zero exit status: 1

==> Some builds didn't complete successfully and had errors:
--> docker: Upload failed with non-zero exit status: 1

==> Builds finished but no artifacts were created.

You can always disable requiretty in the sudoers file and that will allow sudo to work fine.

@stefancocora I compiled w/ the patch for OSX if you want I can submit a PR w/ a branch. For now if anyone wants them here they are.

@stefancocora Your repo works for Arch x86_64 with docker 1.5.0. Thank you

@chiefy don't worry about a PR, I'm hoping my build for linux and your build for osx won't have to exist for long. I'm hoping that this gets fixed in the upstream packer code soon ...

@stefancocora :+1: yeah, i concur.

+1

I'm seeing this issue as well.

$ packer version
Packer v0.7.5

$ docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

+1 From the mailing list:

https://mail.google.com/mail/u/0/?shva=1#label/Hashicorp%2Fpacker/14c1113f7041d655

Hi,
while this issue is unresolved and proposed patch seems to work, for convenience I've pushed a prebuilt linux_x64 version to bintray here. This is build of current master HEAD, because I couldn't build at v0.7.5 tag.

I've been working on a related issue: https://github.com/mitchellh/packer/issues/1975

This patch resolved the initial issue, but now the run hangs at

2015/03/17 13:17:47 packer-builder-docker: 2015/03/17 13:17:47 Waiting for exit code to appear for remote command...

I attached to the container and verified that the command ran, and the exit code 0 was written to the exit file, but the build never progresses. I'm seeing the same issue with both the shell and chef-solo provisioners on Ubuntu14.04 and CentOS6.

Packer Version 0.7.5 using the patched binary from chiefy
docker-machine version 0.1.0 using Virtualbox driver
Host is running OSX 10.9.5

$ docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): darwin/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

https://mail.google.com/mail/u/0/?shva=1#label/Hashicorp%2Fpacker/14c1113f7041d655

@kikitux FYI: That's a link to something in your Gmail inbox. We can't see that.

Also having this problem with packer 0.7.5 and docker 1.5.0

Also able to reproduce on OSX using Boot2Docker-cli version: v1.5.0

packer version

Packer v0.7.5

docker version

Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): darwin/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

The patch proposed by @alkersan does not appear to work with a remote docker host. I have the same docker version (1.5) on both a docker client and server with the patched version of packer on both. It works fine on the docker server, but hangs on the client

+1

+1

the same for Docker 1.6

I've tested the binaries provided by @stefancocora on CentOS 7 with Docker 1.6 and packer worked.

I compiled my own binaries based on master for Fedora 21 with Docker 1.6, and packer worked.

still hangs for me when using a remote docker host, but works fine locally

ubuntu trusty and docker 1.6 fails as well

Also having the issue on both:
OpenSUSE 13.1 x86_64 && OSX 10.10

with:

$ packer version
Packer v0.7.5

and

$ docker version
Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): linux/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 4749651
OS/Arch (server): linux/amd64

i ended up downgrading to docker 1.3.2 where this works (on the OpenSUSE system).
I tried 1.3.2 and 1.3.0 on the OSX 10.10 with no luck.

Ok, so I'm understanding that I may need to downgrade to docker 1.3.2 to get my packer build shell scripts to work with docker. Can anybody provide directions on how to install docker 1.3.2 on Ubuntu (trusty), I can't find out how.

ok found it!

sudo apt-get install lxc-docker-1.3.2

and that fixed the problem. I was using the latest version of docker before, whatever that one is.

Seems to fail with docker 1.6.0 on Ubuntu 14.04 as well.
When doing 'sudo apt-get install lxc-docker-1.3.2' as d3netxer said (without first uninstalling anything) it seems to work.

@dietervds
have you tried the binaries that I've created with the fix for this issue ?
https://github.com/stefancocora/packer-issue1752-fix

@mindscratch has confirmed 16days ago that the binaries I've created work with docker 1.6 and CentOS7

@stefancocora
https://github.com/stefancocora/packer-issue1752-fix works for me on Fedora 21 with Docker 1.6.0 once I set SELinux to Permissive Mode. It also works on CentOS 7 with Docker 1.5.0, with SELinux to Permissive, and on Ubuntu 15.04 with Docker 1.5.0.

Is this only broken for shell script provisioning? It seems to be failing with the chef-solo provisioner as well, but I'm still very new to docker / chef / packer, so my issue could be somewhere else.

Versions:
Docker v1.5
Packer v0.7.5

template:

{
  "builders": [
    {
      "type": "docker",
      "image": "ubuntu:14.04",
      "export_path": "{{pwd}}/utils.img"
    }
  ],
  "provisioners": [
    {
      "type": "chef-solo",
      "cookbook_paths": "{{pwd}}/cookbooks"
    }
  ]
}

The chef-solo provisioner is based on the shell provisioner, so both are broken. Very sad that this bug gets no attention by the core team. Seems like shipping new products is more important than maintaining existent ones. :(

Indeed.

Hey @mitchellh, is there a chance this bug gets fixed for an 0.8 release?

Hi,

When will this patched version will be officially out ? It works for me too (https://github.com/stefancocora/packer-issue1752-fix)

Thanks

+1

This is a pretty serious blocker for anybody who wants to do docker+chef. I can't possibly recommend this for my team if it requires patching what feels like half the toolchain.

It actually impacts a number of pieces when using the docker builder.
Fortunately the patch works.

On Thu, May 21, 2015 at 5:57 PM, Matt Chu [email protected] wrote:

+1

This is a pretty serious blocker for anybody who wants to do docker+chef.
I can't possibly recommend this for my team if it requires patching what
feels like half the toolchain.


Reply to this email directly or view it on GitHub
https://github.com/mitchellh/packer/issues/1752#issuecomment-104444469.

i am also blocked on using docker + chef, like @thmttch ..
i hope the maintainers can get round to merging it in soon (the fact that they haven't worries me that they might have another solution in mind altogether?)

just ran into this as well. Will try the patch as a workaround. Using docker-machine and docker 1.6.2

Fixed!

THANK YOU @mitchellh!!!! I was about to retire packer in favor of Docerkfiles (shudder) because this was breaking my deployment. You continue to be one of my constant heroes saving me hours and hours of my life.

AWESOME!! \m/
Thanks!!

On 29 May 2015 at 20:56, Mitchell Hashimoto [email protected]
wrote:

Closed #1752 https://github.com/mitchellh/packer/issues/1752.


Reply to this email directly or view it on GitHub
https://github.com/mitchellh/packer/issues/1752#event-317473314.

Huge help, thanks!

I apologize for the long delay :( We'll get a Packer release out very shortly with lots of Docker bug fixes.

fantastic news! will be looking forward to that ;)

Thanks! Been looking forward to this!

@mitchellh When is the next release planned that includes this fix?

@stefancocora Thanks for interim fix!

awesome guys. Great work!

@aidanjl no problem , it is the least I could do to make @mariussturm fix easily accessible for anybody !

@mitchellh please upgrade the packer that Atlas is using with this fix too, because currently i cannot build any docker images in Atlas. I need this to demo Atlas to my manager this thursday for we can buy Atlas.

I'm currently running Packer 0.8-dev and Docker 1.6.2 on OS X and still seeing this issue.

==> docker: Provisioning with shell script: /var/folders/7z/3_4h7g_x55b_stn8nyd2w4mc0000gn/T/packer-shell921079459
2015/06/19 15:13:00 packer-provisioner-shell: 2015/06/19 15:13:00 [INFO] 92 bytes written for 'uploadData'
2015/06/19 15:13:00 [INFO] 92 bytes written for 'uploadData'
2015/06/19 15:13:00 packer-builder-docker: 2015/06/19 15:13:00 Executing in container b77320622ccd70b787bf85e0d88680db0a8a29ea4946aad7d18ceb7dc181362c: "(command cp /packer-files/upload556204673 /tmp/script_7943.sh) >/packer-files/cmd576371692 2>&1; echo $? >/packer-files/cmd576371692-exit"
2015/06/19 15:13:02 packer-builder-docker: 2015/06/19 15:13:02 Waiting for exit code to appear for remote command...

I've also tried downgrading to Docker 1.3.3 and encountering the same thing.

Packer v0.8.0 was tagged and released to the downloads page yesterday, which should actually fix this. It's working for me with Docker 1.5.0, after upgrading Packer 0.7.5 to 0.8.0.

verified and working correctly with Packer v0.8.0 and docker Client version: 1.6.2 on an Ubuntu 14.04 x64 host.

I'm still experiencing this issue on osx. Packer version 0.8.0, docker version 1.6.2 and 1.7.0. Will have a go on a linux distro to see if I have any more luck.

Same as @lukeowen89
Kind of a drag I still can't packer on osx at this point.

Also broken for me on OSX. Packer 0.8.1, Docker 1.7.1

packer debug log

2015/07/15 23:42:08 [INFO] Packer version: 0.8.1  872e78d5b0a387eb3b87ddeef210264c3199d178+CHANGES
2015/07/15 23:42:08 Packer Target OS/Arch: darwin amd64
2015/07/15 23:42:08 Built with Go Version: go1.4.2
2015/07/15 23:42:08 [DEBUG] Discovered plugin: amazon-chroot = /usr/local/bin/packer-builder-amazon-chroot
2015/07/15 23:42:08 [DEBUG] Discovered plugin: amazon-ebs = /usr/local/bin/packer-builder-amazon-ebs
2015/07/15 23:42:08 [DEBUG] Discovered plugin: amazon-instance = /usr/local/bin/packer-builder-amazon-instance
2015/07/15 23:42:08 [DEBUG] Discovered plugin: digitalocean = /usr/local/bin/packer-builder-digitalocean
2015/07/15 23:42:08 [DEBUG] Discovered plugin: docker = /usr/local/bin/packer-builder-docker
2015/07/15 23:42:08 [DEBUG] Discovered plugin: file = /usr/local/bin/packer-builder-file
2015/07/15 23:42:08 [DEBUG] Discovered plugin: googlecompute = /usr/local/bin/packer-builder-googlecompute
2015/07/15 23:42:08 [DEBUG] Discovered plugin: null = /usr/local/bin/packer-builder-null
2015/07/15 23:42:08 [DEBUG] Discovered plugin: openstack = /usr/local/bin/packer-builder-openstack
2015/07/15 23:42:08 [DEBUG] Discovered plugin: parallels-iso = /usr/local/bin/packer-builder-parallels-iso
2015/07/15 23:42:08 [DEBUG] Discovered plugin: parallels-pvm = /usr/local/bin/packer-builder-parallels-pvm
2015/07/15 23:42:08 [DEBUG] Discovered plugin: qemu = /usr/local/bin/packer-builder-qemu
2015/07/15 23:42:08 [DEBUG] Discovered plugin: virtualbox-iso = /usr/local/bin/packer-builder-virtualbox-iso
2015/07/15 23:42:08 [DEBUG] Discovered plugin: virtualbox-ovf = /usr/local/bin/packer-builder-virtualbox-ovf
2015/07/15 23:42:08 [DEBUG] Discovered plugin: vmware-iso = /usr/local/bin/packer-builder-vmware-iso
2015/07/15 23:42:08 [DEBUG] Discovered plugin: vmware-vmx = /usr/local/bin/packer-builder-vmware-vmx
2015/07/15 23:42:08 [DEBUG] Discovered plugin: atlas = /usr/local/bin/packer-post-processor-atlas
2015/07/15 23:42:08 [DEBUG] Discovered plugin: compress = /usr/local/bin/packer-post-processor-compress
2015/07/15 23:42:08 [DEBUG] Discovered plugin: docker-import = /usr/local/bin/packer-post-processor-docker-import
2015/07/15 23:42:08 [DEBUG] Discovered plugin: docker-push = /usr/local/bin/packer-post-processor-docker-push
2015/07/15 23:42:08 [DEBUG] Discovered plugin: docker-save = /usr/local/bin/packer-post-processor-docker-save
2015/07/15 23:42:08 [DEBUG] Discovered plugin: docker-tag = /usr/local/bin/packer-post-processor-docker-tag
2015/07/15 23:42:08 [DEBUG] Discovered plugin: vagrant = /usr/local/bin/packer-post-processor-vagrant
2015/07/15 23:42:08 [DEBUG] Discovered plugin: vagrant-cloud = /usr/local/bin/packer-post-processor-vagrant-cloud
2015/07/15 23:42:08 [DEBUG] Discovered plugin: vsphere = /usr/local/bin/packer-post-processor-vsphere
2015/07/15 23:42:08 [DEBUG] Discovered plugin: ansible-local = /usr/local/bin/packer-provisioner-ansible-local
2015/07/15 23:42:08 [DEBUG] Discovered plugin: chef-client = /usr/local/bin/packer-provisioner-chef-client
2015/07/15 23:42:08 [DEBUG] Discovered plugin: chef-solo = /usr/local/bin/packer-provisioner-chef-solo
2015/07/15 23:42:08 [DEBUG] Discovered plugin: file = /usr/local/bin/packer-provisioner-file
2015/07/15 23:42:08 [DEBUG] Discovered plugin: powershell = /usr/local/bin/packer-provisioner-powershell
2015/07/15 23:42:08 [DEBUG] Discovered plugin: puppet-masterless = /usr/local/bin/packer-provisioner-puppet-masterless
2015/07/15 23:42:08 [DEBUG] Discovered plugin: puppet-server = /usr/local/bin/packer-provisioner-puppet-server
2015/07/15 23:42:08 [DEBUG] Discovered plugin: salt-masterless = /usr/local/bin/packer-provisioner-salt-masterless
2015/07/15 23:42:08 [DEBUG] Discovered plugin: shell = /usr/local/bin/packer-provisioner-shell
2015/07/15 23:42:08 [DEBUG] Discovered plugin: shell-local = /usr/local/bin/packer-provisioner-shell-local
2015/07/15 23:42:08 [DEBUG] Discovered plugin: windows-restart = /usr/local/bin/packer-provisioner-windows-restart
2015/07/15 23:42:08 [DEBUG] Discovered plugin: windows-shell = /usr/local/bin/packer-provisioner-windows-shell
2015/07/15 23:42:08 Detected home directory from env var: /Users/bob
2015/07/15 23:42:08 Detected home directory from env var: /Users/bob
2015/07/15 23:42:08 Attempting to open config file: /Users/bob/.packerconfig
2015/07/15 23:42:08 [WARN] Config file doesn't exist: /Users/bob/.packerconfig
2015/07/15 23:42:08 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[digitalocean:/usr/local/bin/packer-builder-digitalocean googlecompute:/usr/local/bin/packer-builder-googlecompute virtualbox-ovf:/usr/local/bin/packer-builder-virtualbox-ovf amazon-instance:/usr/local/bin/packer-builder-amazon-instance vmware-vmx:/usr/local/bin/packer-builder-vmware-vmx amazon-chroot:/usr/local/bin/packer-builder-amazon-chroot null:/usr/local/bin/packer-builder-null vmware-iso:/usr/local/bin/packer-builder-vmware-iso openstack:/usr/local/bin/packer-builder-openstack parallels-iso:/usr/local/bin/packer-builder-parallels-iso parallels-pvm:/usr/local/bin/packer-builder-parallels-pvm qemu:/usr/local/bin/packer-builder-qemu virtualbox-iso:/usr/local/bin/packer-builder-virtualbox-iso amazon-ebs:/usr/local/bin/packer-builder-amazon-ebs docker:/usr/local/bin/packer-builder-docker file:/usr/local/bin/packer-builder-file] PostProcessors:map[atlas:/usr/local/bin/packer-post-processor-atlas docker-tag:/usr/local/bin/packer-post-processor-docker-tag vagrant-cloud:/usr/local/bin/packer-post-processor-vagrant-cloud vsphere:/usr/local/bin/packer-post-processor-vsphere compress:/usr/local/bin/packer-post-processor-compress docker-import:/usr/local/bin/packer-post-processor-docker-import docker-push:/usr/local/bin/packer-post-processor-docker-push docker-save:/usr/local/bin/packer-post-processor-docker-save vagrant:/usr/local/bin/packer-post-processor-vagrant] Provisioners:map[shell-local:/usr/local/bin/packer-provisioner-shell-local windows-shell:/usr/local/bin/packer-provisioner-windows-shell ansible-local:/usr/local/bin/packer-provisioner-ansible-local chef-client:/usr/local/bin/packer-provisioner-chef-client file:/usr/local/bin/packer-provisioner-file salt-masterless:/usr/local/bin/packer-provisioner-salt-masterless shell:/usr/local/bin/packer-provisioner-shell chef-solo:/usr/local/bin/packer-provisioner-chef-solo powershell:/usr/local/bin/packer-provisioner-powershell puppet-masterless:/usr/local/bin/packer-provisioner-puppet-masterless puppet-server:/usr/local/bin/packer-provisioner-puppet-server windows-restart:/usr/local/bin/packer-provisioner-windows-restart]}
2015/07/15 23:42:08 Setting cache directory: /Users/bob/Projects/garbanzo/packer_cache
2015/07/15 23:42:08 Detected home directory from env var: /Users/bob
2015/07/15 23:42:08 Loading builder: docker
2015/07/15 23:42:08 Creating plugin client for path: /usr/local/bin/packer-builder-docker
2015/07/15 23:42:08 Starting plugin: /usr/local/bin/packer-builder-docker []string{"/usr/local/bin/packer-builder-docker"}
2015/07/15 23:42:08 Waiting for RPC address for: /usr/local/bin/packer-builder-docker
2015/07/15 23:42:08 packer-builder-docker: 2015/07/15 23:42:08 Plugin minimum port: 10000
2015/07/15 23:42:08 packer-builder-docker: 2015/07/15 23:42:08 Plugin maximum port: 25000
2015/07/15 23:42:08 packer-builder-docker: 2015/07/15 23:42:08 Plugin address: unix /var/folders/4j/hd7wss1n4xzc8xn224xsyls80000gn/T/packer-plugin389384987
2015/07/15 23:42:08 packer-builder-docker: 2015/07/15 23:42:08 Waiting for connection...
2015/07/15 23:42:08 packer-builder-docker: 2015/07/15 23:42:08 Serving a plugin connection...
2015/07/15 23:42:08 Loading provisioner: shell
2015/07/15 23:42:08 Creating plugin client for path: /usr/local/bin/packer-provisioner-shell
2015/07/15 23:42:08 Starting plugin: /usr/local/bin/packer-provisioner-shell []string{"/usr/local/bin/packer-provisioner-shell"}
2015/07/15 23:42:08 Waiting for RPC address for: /usr/local/bin/packer-provisioner-shell
2015/07/15 23:42:08 packer-provisioner-shell: 2015/07/15 23:42:08 Plugin minimum port: 10000
2015/07/15 23:42:08 packer-provisioner-shell: 2015/07/15 23:42:08 Plugin maximum port: 25000
2015/07/15 23:42:08 packer-provisioner-shell: 2015/07/15 23:42:08 Plugin address: unix /var/folders/4j/hd7wss1n4xzc8xn224xsyls80000gn/T/packer-plugin592962254
2015/07/15 23:42:08 packer-provisioner-shell: 2015/07/15 23:42:08 Waiting for connection...
2015/07/15 23:42:08 packer-provisioner-shell: 2015/07/15 23:42:08 Serving a plugin connection...
2015/07/15 23:42:08 Loading post-processor: docker-tag
2015/07/15 23:42:08 Creating plugin client for path: /usr/local/bin/packer-post-processor-docker-tag
2015/07/15 23:42:08 Starting plugin: /usr/local/bin/packer-post-processor-docker-tag []string{"/usr/local/bin/packer-post-processor-docker-tag"}
2015/07/15 23:42:08 Waiting for RPC address for: /usr/local/bin/packer-post-processor-docker-tag
2015/07/15 23:42:08 packer-post-processor-docker-tag: 2015/07/15 23:42:08 Plugin minimum port: 10000
2015/07/15 23:42:08 packer-post-processor-docker-tag: 2015/07/15 23:42:08 Plugin maximum port: 25000
2015/07/15 23:42:08 packer-post-processor-docker-tag: 2015/07/15 23:42:08 Plugin address: unix /var/folders/4j/hd7wss1n4xzc8xn224xsyls80000gn/T/packer-plugin099680253
2015/07/15 23:42:08 packer-post-processor-docker-tag: 2015/07/15 23:42:08 Waiting for connection...
2015/07/15 23:42:08 packer-post-processor-docker-tag: 2015/07/15 23:42:08 Serving a plugin connection...
2015/07/15 23:42:08 ui: docker output will be in this color.
2015/07/15 23:42:08 ui: 
2015/07/15 23:42:08 Build debug mode: false
2015/07/15 23:42:08 Force build: false
2015/07/15 23:42:08 Preparing build: docker
docker output will be in this color.

2015/07/15 23:42:08 Waiting on builds to complete...
2015/07/15 23:42:08 Starting build run: docker
2015/07/15 23:42:08 Running builder: docker
2015/07/15 23:42:08 packer-builder-docker: 2015/07/15 23:42:08 [DEBUG] Docker version: 1.7.1
2015/07/15 23:42:08 ui: ==> docker: Creating a temporary directory for sharing data...
==> docker: Creating a temporary directory for sharing data...
2015/07/15 23:42:08 ui: ==> docker: Pulling Docker image: gliderlabs/herokuish
==> docker: Pulling Docker image: gliderlabs/herokuish
2015/07/15 23:42:08 packer-builder-docker: 2015/07/15 23:42:08 Executing: /usr/local/bin/docker [pull gliderlabs/herokuish]
2015/07/15 23:42:11 ui:     docker: latest: Pulling from gliderlabs/herokuish
    docker: latest: Pulling from gliderlabs/herokuish
2015/07/15 23:42:11 ui:     docker: 835c565d00e2: Already exists
    docker: 835c565d00e2: Already exists
2015/07/15 23:42:11 ui:     docker: c5c659229e15: Already exists
    docker: c5c659229e15: Already exists
2015/07/15 23:42:11 ui:     docker: 9a8403cd4d99: Already exists
    docker: 9a8403cd4d99: Already exists
2015/07/15 23:42:11 ui:     docker: 89fc314a0a6e: Already exists
    docker: 89fc314a0a6e: Already exists
2015/07/15 23:42:11 ui:     docker: d257698c42c5: Already exists
    docker: d257698c42c5: Already exists
2015/07/15 23:42:11 ui:     docker: c6c6baedb602: Already exists
    docker: c6c6baedb602: Already exists
2015/07/15 23:42:11 ui:     docker: c6c6baedb602: Already exists
    docker: c6c6baedb602: Already exists
2015/07/15 23:42:11 ui:     docker: Digest: sha256:4b08475f91eaccceb40fcbb5e0c43a992257b1bdedbf86f2777f458da9a0e2cd
2015/07/15 23:42:11 ui:     docker: Status: Image is up to date for gliderlabs/herokuish:latest
    docker: Digest: sha256:4b08475f91eaccceb40fcbb5e0c43a992257b1bdedbf86f2777f458da9a0e2cd
    docker: Status: Image is up to date for gliderlabs/herokuish:latest
2015/07/15 23:42:11 ui: ==> docker: Starting docker container...
==> docker: Starting docker container...
2015/07/15 23:42:11 ui:     docker: Run command: docker run -v /Users/bob/Projects/garbanzo:/tmp/app -v /var/folders/4j/hd7wss1n4xzc8xn224xsyls80000gn/T/packer-docker638187454:/packer-files -d -i -t gliderlabs/herokuish /bin/bash
2015/07/15 23:42:11 packer-builder-docker: 2015/07/15 23:42:11 Starting container with args: [run -v /Users/bob/Projects/garbanzo:/tmp/app -v /var/folders/4j/hd7wss1n4xzc8xn224xsyls80000gn/T/packer-docker638187454:/packer-files -d -i -t gliderlabs/herokuish /bin/bash]
    docker: Run command: docker run -v /Users/bob/Projects/garbanzo:/tmp/app -v /var/folders/4j/hd7wss1n4xzc8xn224xsyls80000gn/T/packer-docker638187454:/packer-files -d -i -t gliderlabs/herokuish /bin/bash
2015/07/15 23:42:11 packer-builder-docker: 2015/07/15 23:42:11 Waiting for container to finish starting
2015/07/15 23:42:11 ui:     docker: Container ID: cc6a7056923234a1264718283c1a58a1c49796d64458cefe84e5ee4941c4bf16
    docker: Container ID: cc6a7056923234a1264718283c1a58a1c49796d64458cefe84e5ee4941c4bf16
2015/07/15 23:42:11 packer-builder-docker: 2015/07/15 23:42:11 Running the provision hook
2015/07/15 23:42:11 ui: ==> docker: Provisioning with shell script: /var/folders/4j/hd7wss1n4xzc8xn224xsyls80000gn/T/packer-shell845253589
2015/07/15 23:42:11 packer-provisioner-shell: 2015/07/15 23:42:11 Opening /var/folders/4j/hd7wss1n4xzc8xn224xsyls80000gn/T/packer-shell845253589 for reading
==> docker: Provisioning with shell script: /var/folders/4j/hd7wss1n4xzc8xn224xsyls80000gn/T/packer-shell845253589
2015/07/15 23:42:11 packer-provisioner-shell: 2015/07/15 23:42:11 [INFO] 44 bytes written for 'uploadData'
2015/07/15 23:42:11 [INFO] 44 bytes written for 'uploadData'
2015/07/15 23:42:11 packer-builder-docker: 2015/07/15 23:42:11 Executing in container cc6a7056923234a1264718283c1a58a1c49796d64458cefe84e5ee4941c4bf16: "(command cp /packer-files/upload803520517 /tmp/script_7943.sh) >/packer-files/cmd416685472 2>&1; echo $? >/packer-files/cmd416685472-exit"
2015/07/15 23:42:13 packer-builder-docker: 2015/07/15 23:42:13 Waiting for exit code to appear for remote command...
^C
2015/07/15 23:50:00 Closing stdin because interrupt received.
2015/07/15 23:50:00 Stopping build: docker
2015/07/15 23:50:00 packer-post-processor-docker-tag: 2015/07/15 23:50:00 Received interrupt signal (count: 1). Ignoring.
2015/07/15 23:50:00 packer-provisioner-shell: 2015/07/15 23:50:00 Received interrupt signal (count: 1). Ignoring.
2015/07/15 23:50:00 packer-builder-docker: 2015/07/15 23:50:00 Received interrupt signal (count: 1). Ignoring.
2015/07/15 23:50:00 packer-builder-docker: 2015/07/15 23:50:00 Cancelling the step runner...
2015/07/15 23:50:01 packer-builder-docker: 2015/07/15 23:50:01 Cancelling provisioning due to interrupt...
2015/07/15 23:50:01 Provisioner.Cancel err: unexpected EOF
2015/07/15 23:50:01 /usr/local/bin/packer-provisioner-shell: plugin process exited
2015/07/15 23:50:01 ui: ==> docker: Killing the container: cc6a7056923234a1264718283c1a58a1c49796d64458cefe84e5ee4941c4bf16
==> docker: Killing the container: cc6a7056923234a1264718283c1a58a1c49796d64458cefe84e5ee4941c4bf16
2015/07/15 23:50:01 Build cancelled: docker
2015/07/15 23:50:01 ui: Build 'docker' finished.
2015/07/15 23:50:01 Builds completed. Waiting on interrupt barrier...
2015/07/15 23:50:01 ui: Cleanly cancelled builds after being interrupted.
2015/07/15 23:50:01 waiting for all plugin processes to complete...
Build 'docker' finished.
Cleanly cancelled builds after being interrupted.
2015/07/15 23:50:01 /usr/local/bin/packer-post-processor-docker-tag: plugin process exited
2015/07/15 23:50:01 /usr/local/bin/packer-builder-docker: plugin process exited

poked around on the container before I killed it:

$ ls /packer-files
cmd416685472       cmd416685472-exit
$ cat /packer-files/cmd416685472
cp: cannot stat '/packer-files/upload803520517': No such file or directory

Ditto, experiencing this issue on OSX with Packer 0.8.5 and Docker 1.8.1.

@Decipher I opened a new issue for this here: #2675

This is still a problem on Docker 1.12.1 with packer 0.10.2

I confirm having the same issue using Docker 1.12.1 and Packer 0.11.0.

This for me is only happening when packer is running inside of docker and then trying to provision a new docker. Maybe this is doing it wrong?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tensho picture Tensho  ·  3Comments

mwhooker picture mwhooker  ·  3Comments

jesse-c picture jesse-c  ·  3Comments

znerd picture znerd  ·  3Comments

paulcdejean picture paulcdejean  ·  3Comments