I have a same problem in packer 0.8.6. I am using Boot2Docker-cli version: v1.8.0
Git commit: 9a26066
and docker
:
Client:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 19:47:52 UTC 2015
OS/Arch: darwin/amd64
Server:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:49:29 UTC 2015
OS/Arch: linux/amd64
This is my template.json
:
{
"builders": [
{
"type": "docker",
"image": "ubuntu",
"commit": true
}
],
"provisioners": [
{
"type": "shell",
"script": "setup.sh"
}
]
}
The setup.sh
is:
#!/bin/bash
set -x
set -e
echo Hello
This is a part of the log after running PACKER_LOG=debug packer build template.json
:
==> docker: Provisioning with shell script: setup.sh
2015/08/31 11:15:18 packer-provisioner-shell: 2015/08/31 11:15:18 Opening setup.sh for reading
2015/08/31 11:15:18 packer-provisioner-shell: 2015/08/31 11:15:18 [INFO] 37 bytes written for 'uploadData'
2015/08/31 11:15:18 [INFO] 37 bytes written for 'uploadData'
2015/08/31 11:15:18 packer-builder-docker: 2015/08/31 11:15:18 Executing in container 8c8f8bade4be6d12c6898e1cbcd912ae529eabc7cd3d1b94ad2e805e8d0c6b2a: "(command cp /packer-files/upload262206050 /tmp/script_7943.sh) >/packer-files/cmd300663385 2>&1; echo $? >/packer-files/cmd300663385-exit"
2015/08/31 11:15:20 packer-builder-docker: 2015/08/31 11:15:20 Waiting for exit code to appear for remote command...
It hangs on provisioning. @mitchellh Do you know any work around?
Hmmm, same here !
Same issue. With debug on I'm getting the following error before killing the process:
PACKER_LOG=1 packer build www-docker.json
2015/09/05 17:53:38 [INFO] Packer version: 0.8.6 f8f7b7a34c1be06058f5aca23a51247db12cdbc5+CHANGES
2015/09/05 17:53:38 Packer Target OS/Arch: linux amd64
2015/09/05 17:53:38 Built with Go Version: go1.5
2015/09/05 17:53:38 [DEBUG] Discovered plugin: amazon-chroot = /home/ubuntu/bin/packer-builder-amazon-chroot
2015/09/05 17:53:38 [DEBUG] Discovered plugin: amazon-ebs = /home/ubuntu/bin/packer-builder-amazon-ebs
2015/09/05 17:53:38 [DEBUG] Discovered plugin: amazon-instance = /home/ubuntu/bin/packer-builder-amazon-instance
2015/09/05 17:53:38 [DEBUG] Discovered plugin: digitalocean = /home/ubuntu/bin/packer-builder-digitalocean
2015/09/05 17:53:38 [DEBUG] Discovered plugin: docker = /home/ubuntu/bin/packer-builder-docker
2015/09/05 17:53:38 [DEBUG] Discovered plugin: file = /home/ubuntu/bin/packer-builder-file
2015/09/05 17:53:38 [DEBUG] Discovered plugin: googlecompute = /home/ubuntu/bin/packer-builder-googlecompute
2015/09/05 17:53:38 [DEBUG] Discovered plugin: null = /home/ubuntu/bin/packer-builder-null
2015/09/05 17:53:38 [DEBUG] Discovered plugin: openstack = /home/ubuntu/bin/packer-builder-openstack
2015/09/05 17:53:38 [DEBUG] Discovered plugin: parallels-iso = /home/ubuntu/bin/packer-builder-parallels-iso
2015/09/05 17:53:38 [DEBUG] Discovered plugin: parallels-pvm = /home/ubuntu/bin/packer-builder-parallels-pvm
2015/09/05 17:53:38 [DEBUG] Discovered plugin: qemu = /home/ubuntu/bin/packer-builder-qemu
2015/09/05 17:53:38 [DEBUG] Discovered plugin: virtualbox-iso = /home/ubuntu/bin/packer-builder-virtualbox-iso
2015/09/05 17:53:38 [DEBUG] Discovered plugin: virtualbox-ovf = /home/ubuntu/bin/packer-builder-virtualbox-ovf
2015/09/05 17:53:38 [DEBUG] Discovered plugin: vmware-iso = /home/ubuntu/bin/packer-builder-vmware-iso
2015/09/05 17:53:38 [DEBUG] Discovered plugin: vmware-vmx = /home/ubuntu/bin/packer-builder-vmware-vmx
2015/09/05 17:53:38 [DEBUG] Discovered plugin: artifice = /home/ubuntu/bin/packer-post-processor-artifice
2015/09/05 17:53:38 [DEBUG] Discovered plugin: atlas = /home/ubuntu/bin/packer-post-processor-atlas
2015/09/05 17:53:38 [DEBUG] Discovered plugin: compress = /home/ubuntu/bin/packer-post-processor-compress
2015/09/05 17:53:38 [DEBUG] Discovered plugin: docker-import = /home/ubuntu/bin/packer-post-processor-docker-import
2015/09/05 17:53:38 [DEBUG] Discovered plugin: docker-push = /home/ubuntu/bin/packer-post-processor-docker-push
2015/09/05 17:53:38 [DEBUG] Discovered plugin: docker-save = /home/ubuntu/bin/packer-post-processor-docker-save
2015/09/05 17:53:38 [DEBUG] Discovered plugin: docker-tag = /home/ubuntu/bin/packer-post-processor-docker-tag
2015/09/05 17:53:38 [DEBUG] Discovered plugin: vagrant = /home/ubuntu/bin/packer-post-processor-vagrant
2015/09/05 17:53:38 [DEBUG] Discovered plugin: vagrant-cloud = /home/ubuntu/bin/packer-post-processor-vagrant-cloud
2015/09/05 17:53:38 [DEBUG] Discovered plugin: vsphere = /home/ubuntu/bin/packer-post-processor-vsphere
2015/09/05 17:53:38 [DEBUG] Discovered plugin: ansible-local = /home/ubuntu/bin/packer-provisioner-ansible-local
2015/09/05 17:53:38 [DEBUG] Discovered plugin: chef-client = /home/ubuntu/bin/packer-provisioner-chef-client
2015/09/05 17:53:38 [DEBUG] Discovered plugin: chef-solo = /home/ubuntu/bin/packer-provisioner-chef-solo
2015/09/05 17:53:38 [DEBUG] Discovered plugin: file = /home/ubuntu/bin/packer-provisioner-file
2015/09/05 17:53:38 [DEBUG] Discovered plugin: powershell = /home/ubuntu/bin/packer-provisioner-powershell
2015/09/05 17:53:38 [DEBUG] Discovered plugin: puppet-masterless = /home/ubuntu/bin/packer-provisioner-puppet-masterless
2015/09/05 17:53:38 [DEBUG] Discovered plugin: puppet-server = /home/ubuntu/bin/packer-provisioner-puppet-server
2015/09/05 17:53:38 [DEBUG] Discovered plugin: salt-masterless = /home/ubuntu/bin/packer-provisioner-salt-masterless
2015/09/05 17:53:38 [DEBUG] Discovered plugin: shell = /home/ubuntu/bin/packer-provisioner-shell
2015/09/05 17:53:38 [DEBUG] Discovered plugin: shell-local = /home/ubuntu/bin/packer-provisioner-shell-local
2015/09/05 17:53:38 [DEBUG] Discovered plugin: windows-restart = /home/ubuntu/bin/packer-provisioner-windows-restart
2015/09/05 17:53:38 [DEBUG] Discovered plugin: windows-shell = /home/ubuntu/bin/packer-provisioner-windows-shell
2015/09/05 17:53:38 Detected home directory from env var: /home/ubuntu
2015/09/05 17:53:38 Detected home directory from env var: /home/ubuntu
2015/09/05 17:53:38 Attempting to open config file: /home/ubuntu/.packerconfig
2015/09/05 17:53:38 [WARN] Config file doesn't exist: /home/ubuntu/.packerconfig
2015/09/05 17:53:38 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[amazon-chroot:/home/ubuntu/bin/packer-builder-amazon-chroot virtualbox-iso:/home/ubuntu/bin/packer-builder-virtualbox-iso virtualbox-ovf:/home/ubuntu/bin/packer-builder-virtualbox-ovf amazon-ebs:/home/ubuntu/bin/packer-builder-amazon-ebs file:/home/ubuntu/bin/packer-builder-file null:/home/ubuntu/bin/packer-builder-null openstack:/home/ubuntu/bin/packer-builder-openstack qemu:/home/ubuntu/bin/packer-builder-qemu amazon-instance:/home/ubuntu/bin/packer-builder-amazon-instance googlecompute:/home/ubuntu/bin/packer-builder-googlecompute vmware-iso:/home/ubuntu/bin/packer-builder-vmware-iso digitalocean:/home/ubuntu/bin/packer-builder-digitalocean docker:/home/ubuntu/bin/packer-builder-docker parallels-iso:/home/ubuntu/bin/packer-builder-parallels-iso parallels-pvm:/home/ubuntu/bin/packer-builder-parallels-pvm vmware-vmx:/home/ubuntu/bin/packer-builder-vmware-vmx] PostProcessors:map[vagrant-cloud:/home/ubuntu/bin/packer-post-processor-vagrant-cloud vsphere:/home/ubuntu/bin/packer-post-processor-vsphere artifice:/home/ubuntu/bin/packer-post-processor-artifice compress:/home/ubuntu/bin/packer-post-processor-compress docker-import:/home/ubuntu/bin/packer-post-processor-docker-import docker-save:/home/ubuntu/bin/packer-post-processor-docker-save docker-tag:/home/ubuntu/bin/packer-post-processor-docker-tag atlas:/home/ubuntu/bin/packer-post-processor-atlas docker-push:/home/ubuntu/bin/packer-post-processor-docker-push vagrant:/home/ubuntu/bin/packer-post-processor-vagrant] Provisioners:map[windows-restart:/home/ubuntu/bin/packer-provisioner-windows-restart powershell:/home/ubuntu/bin/packer-provisioner-powershell puppet-masterless:/home/ubuntu/bin/packer-provisioner-puppet-masterless salt-masterless:/home/ubuntu/bin/packer-provisioner-salt-masterless shell:/home/ubuntu/bin/packer-provisioner-shell shell-local:/home/ubuntu/bin/packer-provisioner-shell-local windows-shell:/home/ubuntu/bin/packer-provisioner-windows-shell ansible-local:/home/ubuntu/bin/packer-provisioner-ansible-local chef-client:/home/ubuntu/bin/packer-provisioner-chef-client chef-solo:/home/ubuntu/bin/packer-provisioner-chef-solo file:/home/ubuntu/bin/packer-provisioner-file puppet-server:/home/ubuntu/bin/packer-provisioner-puppet-server]}
2015/09/05 17:53:38 Setting cache directory: /home/ubuntu/www.nr8.com/support/packer/packer_cache
2015/09/05 17:53:38 Loading builder: docker
2015/09/05 17:53:38 Creating plugin client for path: /home/ubuntu/bin/packer-builder-docker
2015/09/05 17:53:38 Starting plugin: /home/ubuntu/bin/packer-builder-docker []string{"/home/ubuntu/bin/packer-builder-docker"}
2015/09/05 17:53:38 Detected home directory from env var: /home/ubuntu
2015/09/05 17:53:38 Waiting for RPC address for: /home/ubuntu/bin/packer-builder-docker
2015/09/05 17:53:38 packer-builder-docker: 2015/09/05 17:53:38 Plugin minimum port: 10000
2015/09/05 17:53:38 packer-builder-docker: 2015/09/05 17:53:38 Plugin maximum port: 25000
2015/09/05 17:53:38 packer-builder-docker: 2015/09/05 17:53:38 Plugin address: unix /tmp/packer-plugin711685037
2015/09/05 17:53:38 packer-builder-docker: 2015/09/05 17:53:38 Waiting for connection...
2015/09/05 17:53:38 packer-builder-docker: 2015/09/05 17:53:38 Serving a plugin connection...
2015/09/05 17:53:38 Loading provisioner: shell
2015/09/05 17:53:38 Creating plugin client for path: /home/ubuntu/bin/packer-provisioner-shell
2015/09/05 17:53:38 Starting plugin: /home/ubuntu/bin/packer-provisioner-shell []string{"/home/ubuntu/bin/packer-provisioner-shell"}
2015/09/05 17:53:38 Waiting for RPC address for: /home/ubuntu/bin/packer-provisioner-shell
2015/09/05 17:53:38 packer-provisioner-shell: 2015/09/05 17:53:38 Plugin minimum port: 10000
2015/09/05 17:53:38 packer-provisioner-shell: 2015/09/05 17:53:38 Plugin maximum port: 25000
2015/09/05 17:53:38 packer-provisioner-shell: 2015/09/05 17:53:38 Plugin address: unix /tmp/packer-plugin038226065
2015/09/05 17:53:38 packer-provisioner-shell: 2015/09/05 17:53:38 Waiting for connection...
2015/09/05 17:53:38 packer-provisioner-shell: 2015/09/05 17:53:38 Serving a plugin connection...
2015/09/05 17:53:38 ui: docker output will be in this color.
2015/09/05 17:53:38 ui:
2015/09/05 17:53:38 Build debug mode: false
2015/09/05 17:53:38 Force build: false
2015/09/05 17:53:38 Preparing build: docker
docker output will be in this color.
2015/09/05 17:53:38 Waiting on builds to complete...
2015/09/05 17:53:38 Starting build run: docker
2015/09/05 17:53:38 Running builder: docker
2015/09/05 17:53:38 packer-builder-docker: 2015/09/05 17:53:38 [DEBUG] Docker version: 1.6.2-circleci
2015/09/05 17:53:38 packer-builder-docker: 2015/09/05 17:53:38 [DEBUG] Container will be exported to containers/www.tar
2015/09/05 17:53:38 ui: ==> docker: Creating a temporary directory for sharing data...
==> docker: Creating a temporary directory for sharing data...
2015/09/05 17:53:38 ui: ==> docker: Pulling Docker image: node:0.12.7-slim
2015/09/05 17:53:38 packer-builder-docker: 2015/09/05 17:53:38 Executing: /usr/bin/docker [pull node:0.12.7-slim]
==> docker: Pulling Docker image: node:0.12.7-slim
2015/09/05 17:53:39 ui: docker: 0.12.7-slim: Pulling from node
docker: 0.12.7-slim: Pulling from node
2015/09/05 17:53:39 ui: docker: 2c49f83e0b13: Already exists
2015/09/05 17:53:39 ui: docker: 4a5e6db8c069: Already exists
docker: 2c49f83e0b13: Already exists
2015/09/05 17:53:39 ui: docker: 0fec679b8d00: Already exists
docker: 4a5e6db8c069: Already exists
docker: 0fec679b8d00: Already exists
2015/09/05 17:53:39 ui: docker: 12374b236af5: Already exists
docker: 12374b236af5: Already exists
docker: 644a9251358e: Already exists
2015/09/05 17:53:39 ui: docker: 644a9251358e: Already exists
docker: 4961af505118: Already exists
2015/09/05 17:53:39 ui: docker: 4961af505118: Already exists
docker: b78366c43734: Already exists
docker: b78366c43734: Already exists
2015/09/05 17:53:39 ui: docker: b78366c43734: Already exists
2015/09/05 17:53:39 ui: docker: b78366c43734: Already exists
docker: Digest: sha256:cb3515b4d09c7d95ba4bb8b8fc6741336a41f847b6f7d0b0df02e057039c6581
2015/09/05 17:53:39 ui: docker: Digest: sha256:cb3515b4d09c7d95ba4bb8b8fc6741336a41f847b6f7d0b0df02e057039c6581
2015/09/05 17:53:39 ui: docker: Status: Image is up to date for node:0.12.7-slim
docker: Status: Image is up to date for node:0.12.7-slim
2015/09/05 17:53:39 ui: ==> docker: Starting docker container...
==> docker: Starting docker container...
2015/09/05 17:53:39 ui: docker: Run command: docker run -v /tmp/packer-docker353904936:/packer-files -d -i -t node:0.12.7-slim /bin/bash
docker: Run command: docker run -v /tmp/packer-docker353904936:/packer-files -d -i -t node:0.12.7-slim /bin/bash
2015/09/05 17:53:39 packer-builder-docker: 2015/09/05 17:53:39 Starting container with args: [run -v /tmp/packer-docker353904936:/packer-files -d -i -t node:0.12.7-slim /bin/bash]
2015/09/05 17:53:39 packer-builder-docker: 2015/09/05 17:53:39 Waiting for container to finish starting
2015/09/05 17:53:41 ui: docker: Container ID: a56942df1c5b03c588501f5887fce6d69a3e0e4adf54894bb3919e000f16c988
docker: Container ID: a56942df1c5b03c588501f5887fce6d69a3e0e4adf54894bb3919e000f16c988
2015/09/05 17:53:41 packer-builder-docker: 2015/09/05 17:53:41 Running the provision hook
2015/09/05 17:53:41 ui: ==> docker: Provisioning with shell script: scripts/setup.sh
==> docker: Provisioning with shell script: scripts/setup.sh
2015/09/05 17:53:41 packer-provisioner-shell: 2015/09/05 17:53:41 Opening scripts/setup.sh for reading
2015/09/05 17:53:41 packer-provisioner-shell: 2015/09/05 17:53:41 [INFO] 35 bytes written for 'uploadData'
2015/09/05 17:53:41 [INFO] 35 bytes written for 'uploadData'
2015/09/05 17:53:41 packer-builder-docker: 2015/09/05 17:53:41 Executing in container a56942df1c5b03c588501f5887fce6d69a3e0e4adf54894bb3919e000f16c988: "(command cp /packer-files/upload006616679 /tmp/script_7943.sh) >/packer-files/cmd179870362 2>&1; echo $? >/packer-files/cmd179870362-exit"
2015/09/05 17:53:43 packer-provisioner-shell: 2015/09/05 17:53:43 Retryable error: Error uploading script: Upload failed with non-zero exit status: 1
2015/09/05 17:53:45 packer-provisioner-shell: 2015/09/05 17:53:45 [INFO] 35 bytes written for 'uploadData'
2015/09/05 17:53:45 [INFO] 35 bytes written for 'uploadData'
2015/09/05 17:53:45 packer-builder-docker: 2015/09/05 17:53:45 Executing in container a56942df1c5b03c588501f5887fce6d69a3e0e4adf54894bb3919e000f16c988: "(command cp /packer-files/upload601043249 /tmp/script_7943.sh) >/packer-files/cmd025884892 2>&1; echo $? >/packer-files/cmd025884892-exit"
2015/09/05 17:53:47 packer-provisioner-shell: 2015/09/05 17:53:47 Retryable error: Error uploading script: Upload failed with non-zero exit status: 1
2015/09/05 17:53:49 packer-provisioner-shell: 2015/09/05 17:53:49 [INFO] 35 bytes written for 'uploadData'
2015/09/05 17:53:49 [INFO] 35 bytes written for 'uploadData'
2015/09/05 17:53:49 packer-builder-docker: 2015/09/05 17:53:49 Executing in container a56942df1c5b03c588501f5887fce6d69a3e0e4adf54894bb3919e000f16c988: "(command cp /packer-files/upload246814347 /tmp/script_7943.sh) >/packer-files/cmd906147950 2>&1; echo $? >/packer-files/cmd906147950-exit"
^C2015/09/05 17:53:50 Closing stdin because interrupt received.
2015/09/05 17:53:50 Stopping build: docker
2015/09/05 17:53:50 packer-builder-docker: 2015/09/05 17:53:50 Received interrupt signal (count: 1). Ignoring.
2015/09/05 17:53:50 packer-builder-docker: 2015/09/05 17:53:50 Cancelling the step runner...
2015/09/05 17:53:50 packer-provisioner-shell: 2015/09/05 17:53:50 Received interrupt signal (count: 1). Ignoring.
==> docker: Killing the container: a56942df1c5b03c588501f5887fce6d69a3e0e4adf54894bb3919e000f16c988
c2015/09/05 17:53:50 packer-builder-docker: 2015/09/05 17:53:50 Cancelling provisioning due to interrupt...
2015/09/05 17:53:50 Provisioner.Cancel err: unexpected EOF
2015/09/05 17:53:50 /home/ubuntu/bin/packer-provisioner-shell: plugin process exited
2015/09/05 17:53:50 ui: ==> docker: Killing the container: a56942df1c5b03c588501f5887fce6d69a3e0e4adf54894bb3919e000f16c988
le2015/09/05 17:53:53 ui: Build 'docker' finished.
2015/09/05 17:53:53 Builds completed. Waiting on interrupt barrier...
2015/09/05 17:53:53 Build cancelled: docker
2015/09/05 17:53:53 ui: Cleanly cancelled builds after being interrupted.
Build 'docker' finished.
2015/09/05 17:53:53 waiting for all plugin processes to complete...
Cleanly cancelled builds after being interrupted.
2015/09/05 17:53:53 /home/ubuntu/bin/packer-builder-docker: plugin process exited
Docker version: Docker version 1.6.2-circleci, build 2f3236d
Packer version: 0.8.6
Packer config:
{
"builders": [
{
"type": "docker",
"image": "node:0.12.7-slim",
"export_path": "containers/www.tar"
}
],
"provisioners": [
{
"type": "shell",
"script": "scripts/setup.sh"
}
]
}
setup.sh:
#!/bin/sh
sudo npm install -g pm2
I should also add that this happens with Ansible as well (not specific to shell scripts). I essentially replicated the mount task Packer is using:
docker run -v /home/ubuntu/www/support/packer/scripts/:/scripts -d -i -t node:0.12.7-slim /bin/bash
Here's the running process:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
54c5f1835bd0 node:0.12.7-slim "/bin/bash" 42 seconds ago Up 40 seconds jolly_mclean
If I execute:
docker exec jolly_mclean sh /scripts/setup.sh
I get:
FATA[0000] Error response from daemon: Unsupported: Exec is not supported by the lxc driver
It's my understanding Packer will fall back on attach
if exec
is not available. I don't know if this is happening, but I suspect it may be the problem we are seeing.
same issue here...
my details:
>docker-machine --version
docker-machine version 0.4.1 (e2c88d6)
>docker version
Client:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:49:29 UTC 2015
OS/Arch: darwin/amd64
Server:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:49:29 UTC 2015
OS/Arch: linux/amd64
>cat mypack.json
{
"variables": {
},
"builders": [{
"type": "docker",
"image": "ubuntu:latest",
"export_path": "ubuntu-image.tar"
}],
"provisioners": [{
"type": "shell",
"inline": [
"echo yo"
]
}]
}
>packer build mypack.json
docker output will be in this color.
==> docker: Creating a temporary directory for sharing data...
==> docker: Pulling Docker image: ubuntu:latest
docker: latest: Pulling from library/ubuntu
docker: d3a1f33e8a5a: Already exists
docker: c22013c84729: Already exists
docker: d74508fb6632: Already exists
docker: 91e54dfb1179: Already exists
docker: Digest: sha256:73fbe2308f5f5cb6e343425831b8ab44f10bbd77070ecdfbe4081daa4dbe3ed1
docker: Status: Image is up to date for ubuntu:latest
==> docker: Starting docker container...
docker: Run command: docker run -v /var/folders/kq/9v2ffnh11rg3r8ns3y5c77tc0000gp/T/packer-docker043536313:/packer-files -d -i -t ubuntu:latest /bin/bash
docker: Container ID: c8aaba70624ae16da2eaa560af95ced518fa4115b1e3dc28ccd0ea95de308afa
==> docker: Provisioning with shell script: /var/folders/kq/9v2ffnh11rg3r8ns3y5c77tc0000gp/T/packer-shell459567714
^C==> docker: Killing the container: c8aaba70624ae16da2eaa560af95ced518fa4115b1e3dc28ccd0ea95de308afa
Build 'docker' finished.
Cleanly cancelled builds after being interrupted.
Any updates on that issue ? I have exactly the same thing on Mac user docker toolbox.
I have the simple build file and it wont finish forever.
{
"builders": [
{
"type": "docker",
"image": "ubuntu:14.04",
"commit": true
}
],
"provisioners": [
{
"type": "shell",
"inline": [
" apt-get -y update"
]
}
],
"post-processors": [
[
{
"type": "docker-tag",
"repository": "gcr.io/wondermall-dev/example",
"tag": "tag1",
"only": ["docker"]
}
]
]
}
I tried the same thing on a Linux machine and there is not problem
problem seems to be that docker-machine only mounts your userfolder into the vm. thus the default tmp packer is using is not available. This is probably similar in case you're using any kind of VM to run docker (e.g. because you're on a mac like me)
fir it by doing mkdir ~/tmp and then executing packer as TMPDIR=~/tmp packer build packer.json
http://chiefy.github.io/2015/02/24/up-and-running-w-boot2docker-fig-packer.html
Glad to see this issue fixed! When can we expect a release with this fix included?
Sweet! Hopefully this should resolve all previous issues. I experienced this problem with many different releases. Please, let us know when your release a new version of packer. Thanks!
I have the same problem on ubuntu 14.04.1 I am using
packer v0.10.0
and docker:
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64
my template and shell script are the same as @svett listed
PACKER_LOG=debug packer build template.json
yields nearly the same results as OP with the exception that in my case i had the line below instead of Waiting for exit code to appear...
in the OP
Retryable error: Error uploading script: Upload failed with non-zero exit status: 1
==> docker: Provisioning with shell script: setup.sh
2016/03/28 01:52:18 ui: ==> docker: Provisioning with shell script: setup.sh
2016/03/28 01:52:18 packer-provisioner-shell: 2016/03/28 01:52:18 Opening setup.sh for reading
2016/03/28 01:52:18 packer-provisioner-shell: 2016/03/28 01:52:18 [INFO] 37 bytes written for 'uploadData'
2016/03/28 01:52:18 [INFO] 37 bytes written for 'uploadData'
2016/03/28 01:52:18 packer-builder-docker: 2016/03/28 01:52:18 Executing in container 40d7e7605d1ba330a5169a46e8dc50884ed896703ec94be167393eb6ff5986db: "(cp /packer-files/upload372519948 /tmp/script.sh) >/packer-files/cmd056858107 2>&1; echo $? >/packer-files/cmd056858107-exit"
2016/03/28 01:52:20 packer-provisioner-shell: 2016/03/28 01:52:20 Retryable error: Error uploading script: Upload failed with non-zero exit status: 1
2016/03/28 01:52:22 packer-provisioner-shell: 2016/03/28 01:52:22 [INFO] 37 bytes written for 'uploadData'
Still seeing this with packer v0.10.1 on Ubuntu 14.04.4. In Sept 2015, @wolfgangpfnuer referenced setting TMPDIR to somewhere under the user's home folder as a possible workaround.
However, this does not seem to change the behavior; I still see exactly what others have described. Has anyone come up with another workaround? Or is there some trick to the TMPDIR that I'm missing?
Basically, I'm running:
env TMPDIR='/home/username/path/to/some/tmp' packer build [args]
Any help would be appreciated.
Temp dir needs to be a path that's accessible from within docker-host. Since you're on Ubuntu I assume you're not using a VM, so you've got a different bug than the one I had...
No, in this case I'm using docker-machine, to more closely match my colleagues' configuration on OS X. Strangely, OS X is _not_ exhibiting the same behavior.
When a packer builds a docker
It鈥檚 called a packer docker-builder
And when the packer's in a docker
It鈥檚 a docker-ed packer-builder.
And when a packer docker-builder runs a docker-ed packer-builder,
They call it a docker-ed packer-builder docker-builder
Now a Mac-ca docker runner is Docker for the Mac-ca
And Docker for the Mac-ca uses Hyper as its 鈥榲isor
With an absence of any VirtualBox-er mocker
And an API exposer through a /var/run/docker.sock-er
Given a Hyper Mac-er packer with Mac-ca User mounter
When the docker-ed packer-builder does a temp dir encounter
Then the temp dir's not covered by the Mac-ca User mounter
It鈥檚 a packer-builder blocker; and so packer does its rocker
Most helpful comment
When a packer builds a docker
It鈥檚 called a packer docker-builder
And when the packer's in a docker
It鈥檚 a docker-ed packer-builder.
And when a packer docker-builder runs a docker-ed packer-builder,
They call it a docker-ed packer-builder docker-builder
Now a Mac-ca docker runner is Docker for the Mac-ca
And Docker for the Mac-ca uses Hyper as its 鈥榲isor
With an absence of any VirtualBox-er mocker
And an API exposer through a /var/run/docker.sock-er
Given a Hyper Mac-er packer with Mac-ca User mounter
When the docker-ed packer-builder does a temp dir encounter
Then the temp dir's not covered by the Mac-ca User mounter
It鈥檚 a packer-builder blocker; and so packer does its rocker