Given:
"provisioners": [
{
"type": "file",
"source": "./app/webroot",
"destination": "/var/www/html/app"
},
When attempting to upload a directory with the file provisioner, the build fails with the following errors:
2017/11/16 20:01:54 packer: 2017/11/16 20:01:54 Running the provision hook
2017/11/16 20:01:54 [INFO] (telemetry) Starting provisioner file
2017/11/16 20:01:54 ui: ==> docker: Uploading ./app/webroot => /var/www/html/app
==> docker: Uploading ./app/webroot => /var/www/html/app
2017/11/16 20:01:54 [INFO] (telemetry) ending file
2017/11/16 20:01:54 [INFO] (telemetry) found error: Failed to upload to '/var/www/html/app' in container: Error response from daemon: lstat /var/lib/docker/overlay/447e151d701d8b8049beba77f9e5973b4f510e84dd2b16ba85932d549ad81316/merged/var/www/html: no such file or directory
. exit status 1.
2017/11/16 20:01:54 ui: ==> docker: Killing the container: 70314be55a5cab47b7862ad5c5990aa9c9bee549a60331b575b7c0847ab1583d
==> docker: Killing the container: 70314be55a5cab47b7862ad5c5990aa9c9bee549a60331b575b7c0847ab1583d
2017/11/16 20:01:54 [INFO] (telemetry) ending docker
This provisioner step works fine with packer 1.0.2.
I have tried it with every 1.1.X release to date as they are released with roughly the same outcome as reported here.
I have been following the following issues which seem to be attempting to address this problem:
https://github.com/hashicorp/packer/pull/5251
https://github.com/hashicorp/packer/issues/5221
I'm afraid I'm unable to reproduce this error. What version of docker are you using?
without first creating the /var/www/html directory, I get this error:
ui error: Build 'goobar' errored: Failed to upload to '/var/www/html/app' in container: Error response from daemon: Could not find the file /var/www/html in container e319b710af6b7a5b809c1756c2ca151d4e6710dddb769954a2c0085c3bc37353
. exit status 1.
but if I create it first it works fine
according to https://stackoverflow.com/questions/41063718/docker-cp-error-response-from-daemon-lstat-no-such-file-or-directory the error you're seeing means the destination directory doesn't exist (possibly different from my error because of docker versions). The file provisioner needs the destination directory to exist to work. What happens if you add
{
"inline": ["mkdir -p /var/www/html"],
"type": "shell"
}
to your provisioners?
Hi @mwhooker.
Docker version is 17.05.0-ce.
In the example, /var/www/html should be present already in the nginx 1.13.6-alpine base image that I'm using.
It's possible that var/www/html/app is not present and that could be just a case of something that worked at/before packer 1.0.2 that maybe should not have.
I'll try some variations of the mkdir and report back.
Both of the variations below seem to work, which is great!
The docker message is absolutely correct. I been using the same line of base image for quite a while now and low and behold they use a _different_ document root directory now. Sorry for the churn. Packer all the things!
"provisioners": [
{
"type": "shell",
"inline": [
"mkdir -p /var/www/html"
]
},
{
"type": "file",
"source": "./app/webroot",
"destination": "/var/www/html/app"
},
"provisioners": [
{
"type": "shell",
"inline": [
"mkdir -p /var/www/html/app"
]
},
{
"type": "file",
"source": "./app/webroot",
"destination": "/var/www/html/app"
},
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Both of the variations below seem to work, which is great!
The docker message is absolutely correct. I been using the same line of base image for quite a while now and low and behold they use a _different_ document root directory now. Sorry for the churn. Packer all the things!