LXD containers are not injected http(s)_proxy variables if those are set to the host
Metadata
Current evaluation
Proxy injection was moved upstream to craft-application and shipped in version 2.0, resolving LXD builds behind host HTTP(S) proxies.
Resolution: closed resolved
Reason: Maintainer @lengau confirmed on 2024-03-12 that the proxy environment-variable injection was included in craft-application 2.0.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
I am trying to run `rockcraft pack` from a system that is running behind a corporate http_proxy. The command fails to run since skopeo is trying to fetch a base ubuntu OCI image from AWS registry and it timeouts. The reason is that the LXD container being created by this project is not injected with proxy variables when those are set to the host. At the same time, this project here is taking care of snap behind proxy scenarios.
### To Reproduce
Install rockcraft in a machine behind an http_proxy and then try to run `rockcraft pack` with any `rockcraft.yaml`
### part yaml
_No response_
### Relevant log output
```shell
ailed to copy image: Command '['/snap/rockcraft/1628/bin/skopeo', '--insecure-policy', '--override-arch', 'amd64', 'copy', '--retry-times', '5', 'docker://public.ecr.aws/ubuntu/ubuntu:22.04', 'oci:/root/images/ubuntu:22.04']' returned non-zero exit status 1. (time="2024-03-07T10:24:50Z" level=warning msg="Failed, retrying in 1s ... (1/5). Error: initializing source docker://public.ecr.aws/ubuntu/ubuntu:22.04: pinging container registry public.ecr.aws: Get \"https://public.ecr.aws/v2/\": dial tcp 99.83.145.10:443: i/o timeout"
time="2024-03-07T10:25:51Z" level=warning msg="Failed, retrying in 2s ... (2/5). Error: initializing source docker://public.ecr.aws/ubuntu/ubuntu:22.04: pinging container registry public.ecr.aws: Get \"https://public.ecr.aws/v2/\": dial tcp 75.2.101.78:443: i/o timeout"
time="2024-03-07T10:26:53Z" level=warning msg="Failed, retrying in 4s ... (3/5). Error: initializing source docker://public.ecr.aws/ubuntu/ubuntu:22.04: pinging container registry public.ecr.aws: Get \"https://public.ecr.aws/v2/\": dial tcp 99.83.145.10:443: i/o timeout"
time="2024-03-07T10:27:57Z" level=warning msg="Failed, retrying in 8s ... (4/5). Error: initializing source docker://public.ecr.aws/ubuntu/ubuntu:22.04: pinging container registry public.ecr.aws: Get \"https://public.ecr.aws/v2/\": dial tcp 75.2.101.78:443: i/o timeout"
time="2024-03-07T10:29:05Z" level=warning msg="Failed, retrying in 16s ... (5/5). Error: initializing source docker://public.ecr.aws/ubuntu/ubuntu:22.04: pinging container registry public.ecr.aws: Get \"https://public.ecr.aws/v2/\": dial tcp 99.83.145.10:443: i/o timeout"
time="2024-03-07T10:30:21Z" level=fatal msg="initializing source docker://public.ecr.aws/ubuntu/ubuntu:22.04: pinging container registry public.ecr.aws: Get \"https://public.ecr.aws/v2/\": dial tcp 99.83.145.10:443: i/o timeout")
Failed to execute rockcraft in instance.
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Proxy injection was moved upstream to craft-application and shipped in version 2.0, resolving LXD builds behind host HTTP(S) proxies. | |
| qwen/qwen3.6-35b-a3b | — | closed resolved | Fixed in craft-application 2.0 by upstreaming http(s)_proxy environment variable injection from snapcraft to craft-providers. |
Update history
| Date | Change |
|---|---|
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1826481 LXDInstanceProvider does not pass proxy information to lxc exec | snapcraft (launchpad) | open | Legacy LXDInstanceProvider didn't forward http_proxy/https_proxy/no_proxy to `lxc exec`. That class is gone; proxy passthrough now happens in snapcraft/providers.py:get_command_environment() via craft-providers, with unit tests and docs. |