Describe the problem and include the following information:
Packer Version - 0.9.0
Host platform - Centos 7.2
I am trying to provision a docker container, and I need the container to have /lib/modules mounted to /lib/modules in the container. Whats strange is when I run the docker run command that Packer says its running, I am able to start the container and do what I need to do.
My Docker command that works -
docker run --privileged -t -i --net=host -v /lib/modules:/lib/modules 9a8c6ee5e82a /bin/bash -c 'sudo /sbin/service iptables restart'
Part of the template concerning this
{ "builders": [{ "type": "docker", "image": "my-img", "pull": false, "export_path": "docker-march.tar", "run_command": [ "--privileged", "-d", "-i", "-t", "--net=host", "-v /lib/modules:/lib/modules", "{{.Image}}", "/bin/sh" ] }],
And the error ==> docker: Error running container: Docker exited with a non-zero exit status. ==> docker: Stderr: flag provided but not defined: -v /lib/modules:/lib/modules
This is what it says its running
docker: Run command: docker run -v /home/my-user/.packer.d/tmp/packer-docker780723700:/packer-files --privileged -d -i -t --net=host -v /lib/modules:/lib/modules top-rhel6-base /bin/sh
Which when I run manually, works.