Packer build error running under WSL

553 views
Skip to first unread message

Dragos Andronache

unread,
Feb 21, 2019, 7:39:11 PM2/21/19
to Packer
Hi all!

I am new to packer but I am trying to get it :). I created a template for a docker image creation. This is the content:

"builders": [{
    "type": "docker",
    "image": "ubuntu",
    "commit": true,
    "run_command": []
  }],
  "provisioners": [

    {
      "type": "shell",
      "inline": ["apt-get update -y && apt-get install -y python2.7 && ln -s /usr/bin/python2.7 /usr/bin/python"]
    },

    {
      "type": "ansible",
      "playbook_file": "../ansible/wordpress.yml"
    }
  ],

I am running packer under WSL (Windows 10) with latest updates. Packer version: 1.0.4. When I try to build the image this is what I get:

docker output will be in this color.

==> docker: Creating a temporary directory for sharing data...
==> docker: Pulling Docker image: ubuntu
    docker: Using default tag: latest
    docker: latest: Pulling from library/ubuntu
    docker: Digest: sha256:7a47ccc3bbe8a451b500d2b53104868b46d60ee8f5b35a24b41a86077c650210
    docker: Status: Image is up to date for ubuntu:latest
==> docker: Starting docker container...
    docker: Run command: docker run -v /root/.packer.d/tmp/packer-docker001065102:/packer-files -d -i -t ubuntu /bin/bash
    docker: Container ID: 9dbe3834c612ce80bf670efd4383edfc0cfff9e8e84161f54df21fc497248eed
==> docker: Provisioning with shell script: /tmp/packer-shell985519329
==> docker: Killing the container: 9dbe3834c612ce80bf670efd4383edfc0cfff9e8e84161f54df21fc497248eed
Build 'docker' errored: Retryable error: Error uploading script: Upload failed with non-zero exit status: 1

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

==> Builds finished but no artifacts were created.

Checking the /tmp/ logs for packer I get a lot of lines with:

2019/02/22 02:22:13 packer: 2019/02/22 02:22:13 [INFO] 107 bytes written for 'uploadData'
2019/02/22 02:22:13 [INFO] 107 bytes written for 'uploadData'
2019/02/22 02:22:13 packer: 2019/02/22 02:22:13 Executing docker exec -i 9dbe3834c612ce80bf670efd4383edfc0cfff9e8e84161f54df21fc497248eed /bin/sh -c (command cp /packer-files/upload322355498 /tmp/script_4968.sh):
2019/02/22 02:22:13 packer: 2019/02/22 02:22:13 Retryable error: Error uploading script: Upload failed with non-zero exit status: 1


Docker under WSL is linked form Docker for Windows.

Please let me know your thoughts regarding this issue.

Thank you!

Megan Marsh

unread,
Feb 21, 2019, 7:41:55 PM2/21/19
to packe...@googlegroups.com
I hate to say it, but our windows support for Docker is pretty terrible and I can almost guarantee that the WSL isn't gonna make it any better. 

Dragos Andronache

unread,
Feb 21, 2019, 7:48:24 PM2/21/19
to Packer
I was thinking about that ... but I guess is still worth asking. Maybe a miracle will happen :)

I know there are alternatives using virtual box, but it would've been great not to install a bunch of same tools on same system.

Thank you for your update, Megan!
Reply all
Reply to author
Forward
0 new messages