GoogleContainerTools / GoogleContainerTools/skaffold
Document puzzling "File Exists" error when attempting to sync
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
@veermuchandi was attempting to set up Skaffold to sync source files into a Docker container image. His dockerfile looked something like:
```
WORKDIR /usr/src/app
USER quarkus
COPY . .
```
But the sync failed:
```
Skipping deploy due to sync error:copying files: running [kubectl --context gke_veer-dil1_us-east1_mygkeautopilot exec quarkfirst-deployment-7675f5b49d-8xp79 --namespace default -c quarkfirst -i -- tar xmf - -C / --no-same-owner]
- stdout: \"\"\n - stderr: \"tar: Removing leading `/' from member names\\ntar: usr/src/app/src/main/java/org/acme/quickstart/GreetingResource.java: Cannot open: File exists\\ntar: Exiting with failure status due to previous errors\\ncommand terminated with exit code 2\\n\"\n - cause: exit status 2
```
It turns out that `/usr/src/app` was owned by `root:root`, and he needed to instead use:
```
COPY --chown=quarkus:root . .
```
The `USER` directive didn't affect the copy ownership or permissions. We should document this in a troubleshooting section on the sync page.
Contributor guide
Assessment
This issue has not been assessed yet.