cli
cli copied to clipboard
[bug] Build args are not resolved over multi-stage build
Description
ARG
commands evaluate to different things in multi-stage builds on macOS (Docker Desktop 20.10.13
) and Linux (20.10.14
).
Steps to reproduce the issue: 1.
FROM alpine:latest as base
ARG NAME="1234"
RUN echo "base:: $NAME"
FROM base AS base-dev
ARG NAME
RUN echo "dev:: $NAME"
FROM base-dev as base-custom
ARG NAME
RUN echo "custom::" $NAME
-
docker build --progress=plain .
- Check output of
custom::
Describe the results you received:
On Docker Desktop on macOS 20.10.13
:
Step 9/9 : RUN echo "custom::" $NAME
---> Running in 1c484bcc731d
custom:: 1234
On Linux 20.10.14
:
Step 9/9 : RUN echo "custom::" $NAME
---> Running in 1c484bcc731d
custom::
Describe the results you expected:
On Linux the output should be also
custom:: 1234
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version
:
Docker version 20.10.14, build a224086 (LINUX)
Docker version 20.10.13, build a224086 (macOS)
Output of docker info
:
Linux:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.1-docker)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 76
Server Version: 20.10.14
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
runc version: v1.0.3-0-gf46b6ba
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.4.0-107-generic
Operating System: Ubuntu 20.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 32
Total Memory: 62.79GiB
Name: gabyx-linux
ID: T4P2:2KQP:6FOQ:YQKN:JXOK:XXD4:XPRY:IA4S:4QOP:B2MQ:XJUI:AFJR
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: gabyxgabyx
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
macOS:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.8.1)
compose: Docker Compose (Docker Inc., v2.3.3)
regctl: Manage docker registries (regclient, 0.1)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Containers: 2
Running: 1
Paused: 0
Stopped: 1
Images: 25
Server Version: 20.10.13
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 2a1d4dbdb2a1030dc5b01e96fb110a9d9f150ecc
runc version: v1.0.3-0-gf46b6ba
init version: de40ad0
Security Options:
seccomp
Profile: default
cgroupns
Kernel Version: 5.10.104-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 9.73GiB
Name: docker-desktop
ID: REL6:ZZ3C:NB2L:Y7Q4:VMEY:BNLB:56PT:4S6U:62QD:Z4HU:UDO3:RK7S
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5000
localhost:5000
127.0.0.0/8
Live Restore Enabled: false
Ok, using # syntax = docker/dockerfile:1.0
and
and docker buildx build
resolves this issue.