Docker Community Forums

Share and learn in the Docker community.

Problem with LABEL in Dockerfile


(Jgossage) #1

I am running Docker on Windows 10 Professional Fall Creators Update. Docker information follows:

Docker Version

D:\GitRepositories\WiseOldBird\Admin\experimental>docker version
Client:
Version: 18.02.0-ce
API version: 1.36
Go version: go1.9.3
Git commit: fc4de44
Built: Wed Feb 7 21:12:53 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm

Server:
Engine:
Version: 18.02.0-ce
API version: 1.36 (minimum version 1.12)
Go version: go1.9.3
Git commit: fc4de44
Built: Wed Feb 7 21:20:15 2018
OS/Arch: linux/amd64
Experimental: true

Docker Info

D:\GitRepositories\WiseOldBird\Admin\experimental>docker info
Containers: 11
Running: 2
Paused: 0
Stopped: 9
Images: 13
Server Version: 18.02.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: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.75-linuxkit-aufs
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: linuxkit-00155d000301
ID: OWUS:ZJGO:KVBH:LM3F:6A4L:AVPN:WUCI:36VU:J6EJ:WCUT:5UXX:K66L
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 27
Goroutines: 51
System Time: 2018-02-15T01:16:22.2603058Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

My Dockerfile:

escape=`

Experimental Ubuntu for learning Docker

FROM ubuntu:latest

Build arguments

ARG locale
ARG timezone
ARG now

Describe the image

LABEL net.wiseoldbird.version=“0.0.1-alpha” net.wiseoldbird.vendor="Wise Old Bird"
net.wiseoldbird.maintainer="gullible1@gmail.net"
LABEL test1="A B C"
LABEL test2=“really?”

What to run

CMD [“bin/bash”]

I run the following commands in a Windows console:

D:\GitRepositories\WiseOldBird\Admin\experimental>docker build --no-cache -t exp1 .
Sending build context to Docker daemon 3.072kB
Step 1/2 : FROM ubuntu:latest
—> 0458a4468cbc
Step 2/2 : LABEL net.wiseoldbird.version=“0.0.1-alpha”
—> Running in 50ba6eb76cd7
Removing intermediate container 50ba6eb76cd7
—> 6106eacb1e73
Successfully built 6106eacb1e73
Successfully tagged exp1:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have ‘-rwxr-xr-x’ permissions. It is recommended to double check and reset permissions for sensitive files and directories.

D:\GitRepositories\WiseOldBird\Admin\experimental>docker inspect --format=’{{.Config.Labels}}’ exp1
’map[net.wiseoldbird.version:0.0.1-alpha]’

My problem is that I am only seeing the first label in the inspect output. I got the same result if I used caching during the build and if I ran docker inspect without filtering. I am completely new to Docker and would be grateful for any suggestions.


(Sunilvalmiki) #2

Multi Labels Should be separated by backslash.

You can follow this example:
LABEL multi.label1="value1" \ multi.label2="value2" \ other="value3"


(Jgossage) #3

I got the same result using that syntax.


(Sunilvalmiki) #4

Refer this document: