hashicorp / packer-plugin-docker

Packer plugin for Docker Builder
https://www.packer.io/docs/builders/docker
Mozilla Public License 2.0
30 stars 26 forks source link

Failed to upload to 'xxx' in container: Error response from daemon: Error processing tar file(exit status 1): chtimes <yyy>: no such file or directory #10

Open ghost opened 3 years ago

ghost commented 3 years ago

This issue was originally opened by @brikis98 as hashicorp/packer#6103. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


I have a Packer template that I'm using to build Docker images. Here's the rough idea of what the template looks like:

{
  "builders": [{
    "name": "ubuntu-docker",
    "type": "docker",
    "image": "gruntwork/ubuntu-test:16.04",
    "commit": true,
    "run_command": ["-d", "-i", "-t", "{{.Image}}", "/sbin/init"],
    "privileged": true,
    "volumes": {
      "/sys/fs/cgroup": "/sys/fs/cgroup"
    }
  }],
  "provisioners": [{
    "type": "file",
    "source": "{{template_dir}}/../../../my-folder-name",
    "destination": "/tmp"
  },{
    "type": "shell",
    "inline": [
      "/tmp/some-script.sh"
    ]
  }],
  "post-processors": [{
    "type": "docker-tag",
    "repository": "gruntwork/my-container",
    "tag": "latest",
    "only": ["ubuntu-docker"]
  }]
}

When I run packer build locally (on my Mac), the Docker container builds just fine. However, when I run my automated tests in CircleCI, which also call packer build, I see an error like this:

Failed to upload to '/tmp' in container: Error response from daemon: Error processing tar file(exit status 1): chtimes /my-folder-name/_docs: no such file or directory

The /my-folder-name/_docs folder definitely exists. The exact file/folder it fails on seems to change from run to run.

A few key notes: