Skip to content

ARG without default value used in FROM does not take any value at all #59

@rrajkomar

Description

@rrajkomar
  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

When defining a build argument in a Dockerfile to beused in the FROM instruction, if the ARG instruction does not have a default value, no value is set to the argument even if you pass a value in the CLI command

Expected behavior

docker build --build-arg BASE_DOCKER_IMAGE=debian:jessie . should create an image with a FROM debian:jessie and the RUN echo instruction shoudl display "debian:jessie"

Actual behavior

Both usage resolve to empty string

Steps to reproduce the behavior

See attached files (remove the txt extension !) for a code sample
docker-compose.yml.txt
Dockerfile.txt

Output of docker version:

Client:
 Version:      17.06.0-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:20:04 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.0-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:18:59 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 26
 Running: 15
 Paused: 0
 Stopped: 11
Images: 832
Server Version: 17.06.0-ce
Storage Driver: aufs
 Root Dir: /opt/docker/aufs
 Backing Filesystem: extfs
 Dirs: 765
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host 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: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.63GiB
Name: morningstar
ID: U3JL:JURH:RYBD:2MSN:RCL3:QUMM:2G3G:JXOJ:5PM6:U64E:6LED:EIJX
Docker Root Dir: /opt/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support

Additional environment details (AWS, VirtualBox, physical, etc.)
Same thing happens when using docker-compose (with the docker-compose file) (which is expected considering the behaviour of docker itself)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions