Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARG support in COPY #2352

Open
FernandoMiguel opened this issue Apr 11, 2018 · 2 comments
Open

ARG support in COPY #2352

FernandoMiguel opened this issue Apr 11, 2018 · 2 comments

Comments

@FernandoMiguel
Copy link
Contributor

Description

Steps to reproduce the issue:

  1. docker build --build-arg IMAGE_BUILDER_NAME=node-builder-ms-xxxx --file Dockerfile/Dockerfile .

Describe the results you received:
invalid from flag value ${IMAGE_BUILDER_NAME}: invalid reference format: repository name must be lowercase

Describe the results you expected:
Successfully built fe978fd298a

Output of docker version:

Client:
 Version:	18.03.0-ce
 API version:	1.37
 Go version:	go1.9.4
 Git commit:	0520e24
 Built:	Wed Mar 21 23:06:22 2018
 OS/Arch:	darwin/amd64
 Experimental:	false
 Orchestrator:	swarm

Server:
 Engine:
  Version:	18.03.0-ce
  API version:	1.37 (minimum version 1.12)
  Go version:	go1.9.4
  Git commit:	0520e24
  Built:	Wed Mar 21 23:14:32 2018
  OS/Arch:	linux/amd64
  Experimental:	true

Output of docker info:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 38
Server Version: 18.03.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfd04396dc68220d1cecbe686a6cc3aa5ce3667c
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.87-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.855GiB
Name: linuxkit-025000000001
ID: MWH6:QH5X:TT3F:ITI2:2C22:XQN3:2E3H:M4GK:HAZH:
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
HTTP Proxy: docker.for.mac.http.internal:3128
HTTPS Proxy: docker.for.mac.http.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false```

**Additional environment details (AWS, VirtualBox, physical, etc.):**

FROM node:8-alpine
ARG IMAGE_BUILDER_NAME
COPY --from=${IMAGE_BUILDER_NAME} /src/dist /app/dist

@szymonpk
Copy link

Hacky workaround, as discussed on the slack:

ARG IMAGE_BUILDER_NAME
FROM ${IMAGE_BUILDER_NAME} as builder
FROM node:8-alpine

<code...>

COPY --from=builder /src/dist /app/dist

It would be nice to have ARG evaluation in COPY.

@hackel
Copy link

hackel commented Aug 6, 2018

FYI—the ARG used in FROM must come before all the FROM lines. Took me way too long to figure this out!

https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact

@thaJeztah thaJeztah transferred this issue from docker/cli Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants