GoogleContainerTools / GoogleContainerTools/skaffold

build can not use dockerfiles out of the docker context

Open
#7,504 1 comment 0 reactions 0 assignees View on GitHub
area/build build/docker kind/feature-request priority/p2
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

`skaffold build` will complain with:

```text
Error response from daemon: forbidden path outside the build context: ../platform/microservice/python3.9-poetry-microservice.dockerfile (). Docker build ran into internal error. Please retry.
If this keeps happening, please open an issue..
```

### Expected behavior
Skaffold should be able to map the configuration to `docker build my-app/ -f platform/microservice/python3.9-poetry-microservice.dockerfile` (even not sure why skaffold is using dockerfile path relative to the context, the documentation says that it is relative to the workspace)

### Actual behavior
Skaffold is failing complaining with an error message indicating the dockerfile is out of the docker context. But docker has not that limitation.

### Information

- Skaffold version: v1.38.0
- Operating system: Centos 8
- Installed via: curl https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
- Contents of skaffold.yaml:

```yaml
apiVersion: skaffold/v2beta11
kind: Config
build:
artifacts:
- image: my-app
context: my-app
docker:
dockerfile: ../platform/microservice/python3.9-poetry-microservice.dockerfile
```

### Steps to reproduce the behavior

1. create skaffold.yaml as provided, create the my-app folder
2. `skaffold build`

logs:
```
- my-app: Not found. Building
INFO[0001] Cache check completed in 1.916 second subtask=-1 task=Build
Starting build...
Building [my-app]...
DEBU[0001] Running docker build: context: my-app, dockerfile: ../platform/microservice/python3.9-poetry-microservice.dockerfile subtask=my-app task=Build
DEBU[0001] Skipping credential configuration because docker-credential-gcloud is not on PATH. subtask=-1 task=DevLoop
Sending build context to Docker daemon 66.72MB
DEBU[0002] Running command: [tput colors] subtask=-1 task=DevLoop
DEBU[0002] Command output: [256
] subtask=-1 task=DevLoop
Error response from daemon: forbidden path outside the build context: ../platform/microservice/python3.9-poetry-microservice.dockerfile (). Docker build ran into internal error. Please retry.
If this keeps happening, please open an issue..
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.