I’m using the docker builder on packer and having an issue. I’m posting here (as well as the packer forums) because it looks to be more of a docker issue than a packer issue.
When I run the packer docker builder, packer is running the following docker command:
docker run -v /var/folders/j4/nqyjdv994637sq_l7_d9465h0000gn/T/packer-docker426021951:/packer-files -d -i -t ubuntu /bin/bash
Docker then fails with the following error:
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-docker426021951
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker → Preferences… → File Sharing.
See https://docs.docker.com/docker.
I have Mac OS version 10.11.5, docker version ‘1.12.5, build 7392c3b’ and packer version 0.12.1. I have shared the /var/folders directory in docker (which it translates to /private). After hours of googling it seems I am the only person in the universe having this issue. For what its worth, the packer config is the most simple possible, simply:
The issue looks to be your path to your mac folder is being truncated at the first space spaces need to be marked with a \ for example a directory called /January 2017 on your mac would be referenced in the command as /January\ 2017/
if this model is being followed correctly then you need to look at whether docker preferences > filesharing has access to the folder you want to map in the container.
Someone who understands how the Docker App works might need to jump in.
if you run PS -Ajcf | grep docker you will see docker is running under your UID I am not seeing your issues but I have my Mac user ID as part of the Wheel group which is why I have no issues i think
this is not an MacOS default for a user so you may need to change that to resolve the issues with access to VAR…
This is a guess on my part so you may want to get another opinion. But I have verified my user is part of group wheel so I have the permissions I need and so does the docker process running under my ID.
@dgarstang The path /var/folders/j4/nqyjdv994637sq_l7_d9465h0000gn/T/packer-docker426021951 isn’t shared from OS X and doesn’t exist in the VM. If it exists in OS X, you could try using /private/var/folders/j4/nqyjdv994637sq_l7_d9465h0000gn/T/packer-docker426021951 or you could edit the OS X directories exported in the File Sharing preferences panel by highlighting /private/var/folders and then clicking again to edit the path and change it to /var/folders.
I have the same problem. Docker desktop for Mac (latest stable) won’t accept ‘/var/lib’ as a path.
When I try ‘docker-compose up’ I get errors like this:
ERROR: for mysql Cannot create container for service mysql: invalid mount config for type “bind”: bind source path does not exist: /var/lib/mydata/mysqldata
Well, I reinstalled docker desktop for Mac, restarted my Mac, cleaned out the app’s data with “Clean / Purge data”, and the above problem is gone. However, I’m now seeing:
ERROR: for livy Cannot start service livy: path /host_mnt/Users/gordonl/n/COMBINEPROJECT/combine-docker/combine/combine is mounted on /host_mnt but it is not a shared mount
I’m confused about how to fix this:
System Preferences?
Command line?
Docker Desktop?
Any help would be appreciated since I’ve been trying to resolve this for a week.