Packer upload doesn't work in circleci docker containers

I’m using packer to build docker images and it works locally but it fails in circleci when trying to upload files into the docker container I’m building.

A minimal example is a to touch a “testfile” then use a packer.json like this:

  "builders": [ {
    "type": "docker",
    "image": "ubuntu",
    "export_path": "image.tar"
  } ],
  "provisioners": [{ "type": "file", "source":"testfile","destination":"/tmp"}]
}```
I've tried docker 1.8 and 1.9 with the circleci-cp-workaround branch. And both packer .9 and .8, but none of them seem to work.

Is there something about the circleci docker environment that prevents this from working? Is there a workaround?

I’m running into the same issues where Packer build fails at the first shell script provisioner.

I tried with the 1.9.1 and 1.10.0 CircleCI Docker versions), both without luck.

ubuntu@box243:~/Packer$ docker version
Client:
 Version:      1.10.0-circleci
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   543ec7b-unsupported
 Built:        Tue Feb 16 17:11:12 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.10.0-circleci
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   543ec7b-unsupported
 Built:        Tue Feb 16 17:11:12 2016
 OS/Arch:      linux/amd64

The error I receive is

2016/06/08 07:18:12 ui error:
==> Some builds didn't complete successfully and had errors:
2016/06/08 07:18:12 machine readable: docker,error []string{"Retryable error: Error uploading script: Upload failed with non-zero exit status: 255"}
2016/06/08 07:18:12 ui error: --> docker: Retryable error: Error uploading script: Upload failed with non-zero exit status: 255

I don’t know the internals much, but I read on the forum something about docker exec vs docker attach and issues with LXC, could that be the cause of this?

I have the same issue.

Minimum, reproducable repo: https://github.com/gfx/packer-on-docker-on-circleci2