apple / apple/container

[Bug]: ADD directive doesn't work with git repos

Open
#513 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
49.9k
Forks
1.8k
Avg merge
1d 20h
Merged PRs (30d)
22

Description

### I have done the following

- [x] I have searched the existing issues
- [ ] If possible, I've reproduced the issue using the 'main' branch of this project

### Steps to reproduce

Trying to build pgvector using `container` and I'm getting the following error.

Repo: https://github.com/pgvector/pgvector

```shell
container build --build-arg PG_MAJOR=17 -t jondaniel/pgvector .
[+] Building 0.6s (4/6)
=> [resolver] fetching image...docker.io/library/postgres:17-bookworm 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [linux/arm64/v8 1/3] ADD https://github.com/pgvector/pgvector.git#v0.8.0 /tmp/pgvector 0.0s
=> oci-layout://docker.io/library/postgres:17-bookworm@sha256:acd32fd91bbdda025a0cc6d9de5666282dfea5d2f30ca7899c1c787f78062121 0.0s
=> => resolve docker.io/library/postgres:17-bookworm@sha256:acd32fd91bbdda025a0cc6d9de5666282dfea5d2f30ca7899c1c787f78062121 0.0s
------
> [linux/arm64/v8 1/3] ADD https://github.com/pgvector/pgvector.git#v0.8.0 /tmp/pgvector:
------
Error: unknown (2): failed to solve: failed to load cache key: unknown scheme git: not found
```

It appears the the problematic line is this `ADD` directive.

```dockerfile
ADD https://github.com/pgvector/pgvector.git#v0.8.0 /tmp/pgvector
```

### Current behavior

Getting an error message when trying to add a file from a URL.

### Expected behavior

Command should work the same as Docker.

### Environment

```markdown
- OS: 15.6 (24G84)
- Xcode: N/A
- Container: container CLI version 0.3.0 (build: release, commit: 3fcf647)
```

### Relevant log output

```shell
container build --build-arg PG_MAJOR=17 -t jondaniel/pgvector .
[+] Building 0.6s (4/6)
=> [resolver] fetching image...docker.io/library/postgres:17-bookworm 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [linux/arm64/v8 1/3] ADD https://github.com/pgvector/pgvector.git#v0.8.0 /tmp/pgvector 0.0s
=> oci-layout://docker.io/library/postgres:17-bookworm@sha256:acd32fd91bbdda025a0cc6d9de5666282dfea5d2f30ca7899c1c787f78062121 0.0s
=> => resolve docker.io/library/postgres:17-bookworm@sha256:acd32fd91bbdda025a0cc6d9de5666282dfea5d2f30ca7899c1c787f78062121 0.0s
------
> [linux/arm64/v8 1/3] ADD https://github.com/pgvector/pgvector.git#v0.8.0 /tmp/pgvector:
------
Error: unknown (2): failed to solve: failed to load cache key: unknown scheme git: not found
```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start with the `container build` handling of Dockerfile `ADD` sources and reproduce the reported pgvector command using the `git` URL and `v0.8.0` ref. Done means a git repository URL with a ref builds successfully, matching Docker's behavior instead of reporting an unknown git scheme.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, swift
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.