Open
Description
When building, the --network
flag affects RUN
statements but not ADD
statements. I would like it to support ADD
too. This would not make builds any less reproducible, because of course you can already use RUN curl
, but ADD
would give better control of cache invalidation.
Test case:
$ sudo docker network create test
587abde5a585f2dc27f8ab92e8f75d2ea58b45bac52f85694940bf038e23a6e7
$ sudo docker run --network test --name web --rm --detach python:3 python -m http.server 80
dcf6d0e8149667c8c2227a5da20449d1b0057a38c1fa1f4790fbdf6c03052bcc
$ cat Dockerfile
FROM alpine:latest
RUN apk add --no-cache curl
RUN curl --remote-name http://web/etc/passwd
ADD http://web/etc/passwd /
$ sudo docker build --network test --no-cache .
Sending build context to Docker daemon 3.072kB
Step 1/4 : FROM alpine:latest
---> 3fd9065eaf02
Step 2/4 : RUN apk add --no-cache curl
---> Running in 24a6911d6fed
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/3) Installing ca-certificates (20171114-r0)
(2/3) Installing libcurl (7.58.0-r0)
(3/3) Installing curl (7.58.0-r0)
Executing busybox-1.27.2-r7.trigger
Executing ca-certificates-20171114-r0.trigger
OK: 5 MiB in 14 packages
Removing intermediate container 24a6911d6fed
---> 985465ec64bb
Step 3/4 : RUN curl --remote-name http://web/etc/passwd
---> Running in c555cfaead80
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1197 100 1197 0 0 194k 0 --:--:-- --:--:-- --:--:-- 194k
Removing intermediate container c555cfaead80
---> 8074dbd6bb96
Step 4/4 : ADD http://web/etc/passwd /
ADD failed: Get http://web/etc/passwd: dial tcp: lookup web: no such host
Metadata
Metadata
Assignees
Labels
No labels