Skip to content

cli: add ability to set domainname and hostname separately #27067

@cyphar

Description

@cyphar

Currently docker run --hostname will set hostname to the full value of the field, even though because of this PR we should be able to specify both without issue. Namely this could be implemented with just a --domainname flag to docker run and the other relevant commands.

% docker version
Client:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        
 OS/Arch:      linux/amd64
% docker info
Containers: 13
 Running: 0
 Paused: 0
 Stopped: 13
Images: 141
Server Version: 1.12.1
Storage Driver: btrfs
 Build Version: Btrfs v4.7.2+20160906
 Library Version: 101
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: overlay host bridge null
Swarm: inactive
Runtimes: oci runc
Default Runtime: oci
Security Options: apparmor
Kernel Version: 4.8.0-rc8-1-default+
Operating System: openSUSE Tumbleweed
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.671 GiB
Name: baradur
ID: DOHI:RAQ5:MYV5:73JL:7UHU:6NXS:RWGD:IQ7D:IQZ2:COCW:BWJ6:HHYN
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
 127.0.0.0/8

What I got:

% docker run --hostname hello.cyphar.com hostname
hello.cyphar.com
% docker run --hostname hello.cyphar.com hostname -f
hello.cyphar.com

What I would like:

% docker run --hostname hello --new-flag-name cyphar.com hostname
hello
% docker run --hostname hello --new-flag-name cyphar.com hostname -f
hello.cyphar.com

This would also have to handle things correct with /etc/hosts, but I assume that the API already handles that (we just need to have the client do it). Cheers.

Metadata

Metadata

Assignees

Labels

area/cliClientkind/enhancementEnhancements are not bugs or new features but can improve usability or performance.status/needs-attentionCalls for a collective discussion during a review sessionversion/1.12

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions