Docker Builder on OSX

197 views
Skip to first unread message

Doug Garstang

unread,
Nov 18, 2016, 11:35:21 AM11/18/16
to Packer
All,

I'm trying to use the docker builder for packer on a mac. My packer template contains:

{
  "builders":[{
    "type": "docker",
    "image": "ubuntu",
    "pull": false,
    "export_path": "image.tar"
  }],
  "provisioners":[
    {
      "type": "shell",
      "inline": ["apt-get -y update; apt-get install -y curl"]
    }
  ]
}

When I run 'packer build packer.json', I get the following failure, which I've cut down on for brevity.

==> docker: Creating a temporary directory for sharing data...
==> docker: Starting docker container...
    docker: Run command: docker run -v /var/folders/j4/nqyjdv994637sq_l7_d9465h0000gn/T/packer-docker306353473:/packer-files -d -i -t ubuntu /bin/bash
==> docker: Error running container: Docker exited with a non-zero exit status.
==> docker: Stderr: docker: Error response from daemon: Mounts denied: -for-mac/osxfs/#namespaces for more info.
==> docker: .
==> docker: sq_l7_d9465h0000gn/T/packer-docker306353473
==> docker: is not shared from OS X and is not known to Docker.
==> docker: You can configure shared paths from Docker -> Preferences... -> File Sharing.
==> docker:
Build 'docker' errored: Error running container: Docker exited with a non-zero exit status.
Stderr: docker: Error response from daemon: Mounts denied: -for-mac/osxfs/#namespaces for more info.
.
sq_l7_d9465h0000gn/T/packer-docker306353473
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.

So... why? The message "Mounts denied: -for-mac/osxfs/#namespaces for more info" isn't even grammatically correct english.

 Packer version is latest 0.12.0. Docker version is latest beta. Also tried with latest stable docker 1.12.3.

The docker preferences show /Users, /Volumes, /tmp and /private. The /var directory is a symlink to /var/private.

Thanks,
Doug.

Alvaro Miranda Aguilera

unread,
Nov 18, 2016, 12:32:40 PM11/18/16
to packe...@googlegroups.com
in linux

you can use -v to share folders between host and VM.

packer is trying to do:
-v /var/folders/j4/nqyjdv994637sq_l7_d9465h0000gn/T/packer-docker306353473:/packer-files 

Can you test manually some -v ?

As is today, it seems packer expect -v to work.

Alvaro.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/26b575e6-3c31-4799-8648-285a113f0fd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Doug Garstang

unread,
Nov 18, 2016, 12:42:18 PM11/18/16
to Packer
Running this works fine:

docker run -v /tmp:/packer-files -d -i -t ubuntu /bin/bash

Running this does not:

docker run -v /var/folders:/packer-files -d -i -t ubuntu /bin/bash

This yields the same error. Why is packer choosing to use /var/folders? Can I set this somewhere? Why is /var/folders in my shared folders in the docker preferences but not working?

Doug.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.



--
Alvaro

Rickard von Essen

unread,
Nov 18, 2016, 1:03:36 PM11/18/16
to packe...@googlegroups.com
What's your output of "docker info" and have you tried to restart Docker 4 Mac? 

For me running your example works nicely with Docker 4 Mac (1.12.3-beta30).

To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/2df8e7f7-c4c1-4fd9-b71c-f3383ca66298%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages