Bug 1465968 - docker run requires the --hostname option to be passed as first argument.
docker run requires the --hostname option to be passed as first argument.
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: doc-Using-Containerized-Identity-Management-Services (Show other bugs)
7.4
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Aneta Šteflová Petrová
ipa-qe
: Documentation
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-28 10:35 EDT by Thorsten Scherf
Modified: 2017-08-23 03:26 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-23 03:26:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Thorsten Scherf 2017-06-28 10:35:26 EDT
Description of problem:
# atomic install rhel7/ipa-server --setup-dns --hostname ipa.dsal.lab.eng.bos.redhat.com
[...]
docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/ipa-server -e NAME=ipa-server -e IMAGE=rhel7/ipa-server rhel7/ipa-server /bin/install.sh --setup-dns --hostname ipa.dsal.lab.eng.bos.redhat.com
+ chroot /host /usr/bin/docker run -ti --rm --name ipa-server -e NAME=ipa-server -e IMAGE=rhel7/ipa-server -v /var/lib/ipa-server:/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp -v /dev/urandom:/dev/random:ro rhel7/ipa-server exit-on-finished --setup-dns --hostname ipa.dsal.lab.eng.bos.redhat.com
systemd 219 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
Detected virtualization docker.
Detected architecture x86-64.
Set hostname to <1acb9d0f9381>.
Initializing machine ID from random generator.
Wed Jun 28 14:27:22 UTC 2017 /usr/sbin/ipa-server-configure-first 
The container has to have fully-qualified hostname defined.

vs

# atomic install --name ipa-server rhel7/ipa-server --hostname ipa.dsal.lab.eng.bos.redhat.com --setup-dns
[...]
docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/ipa-server -e NAME=ipa-server -e IMAGE=rhel7/ipa-server rhel7/ipa-server /bin/install.sh --hostname ipa.dsal.lab.eng.bos.redhat.com --setup-dns
+ chroot /host /usr/bin/docker run -ti --rm --name ipa-server -e NAME=ipa-server -e IMAGE=rhel7/ipa-server -v /var/lib/ipa-server:/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp -v /dev/urandom:/dev/random:ro -h ipa.dsal.lab.eng.bos.redhat.com rhel7/ipa-server exit-on-finished --setup-dns
systemd 219 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
Detected virtualization docker.
Detected architecture x86-64.
Set hostname to <ipa.dsal.lab.eng.bos.redhat.com>.
Initializing machine ID from random generator.
Wed Jun 28 14:30:06 UTC 2017 /usr/sbin/ipa-server-configure-first 

The log file for this installation can be found in /var/log/ipaserver-install.log
==============================================================================
This program will set up the IPA Server.
[...]

The order in which ipa-server-install options are passed to the atomic command should really matter. Or we need to explicitly document it.

Version-Release number of selected component (if applicable):

# atomic images version docker.io/rhel7/ipa-server
IMAGE NAME                                 VERSION   IMAGE ID  
docker.io/rhel7/ipa-server:latest          4.4.0-43  1597cd9c2761

# atomic host status
State: idle
Deployments:
  atomic-host:rhel-atomic-host/7/x86_64/standard
             Version: 7.4.0 (2017-04-28 00:37:19)
              Commit: a235ce70ad4f5b7306d995e1f92308f535d1723e520cb3f6d853005cbebab081
              OSName: atomic-host


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 2 Martin Bašti 2017-07-03 06:59:31 EDT
Thank you for reporting this. It looks that we overlooked this from user perspective.

The --hostname parameter must be first. It is actually "docker keyword", --hostname option in meaning ipa-server-install option is ignored because we cannot change hostname in non-privileged container.

Usage:
atomic install [ --name $THE_NAME ] rhel7/ipa-server [ keywords for docker operation ] [ ipa-server-install | ipa-replica-install ] [ opts ]

Example:
atomic install rhel7/ipa-server --hostname=FQDN ipa-server-install --setup-dns

Aneta we should explicitly document this in the guide IMO.
Comment 3 Aneta Šteflová Petrová 2017-07-03 08:42:29 EDT
Will it help if I add this sentence to the guide?

    "Use --hostname as the first parameter before any Identity Management options."

It could fit well into the Note about --hostname we have in every installation procedure: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7.4-beta/html-single/using_containerized_identity_management_services/#deploying-server-installing-an-identity-management-server-in-a-container-basic


Also, just to be sure: Are examples like this one okay? Can --hostname come after publish?

    atomic install rhel7/ipa-server publish --hostname fully_qualified_domain_name
Comment 4 Martin Bašti 2017-07-12 08:28:11 EDT
Maybe we should be more clear that we actually supports two types of options, atomic/docker related options and IdM installer options and explicitly mention that --hostname is ignored in case when used as installer option.

Maybe would be nice to add ipa-server-install into examples and just say that this is default operation and may be ommited

Also I found that examples with ipa-replica-install have wrong position of --hostname option
Comment 5 Aneta Šteflová Petrová 2017-07-17 04:32:02 EDT
(In reply to Martin Bašti from comment #4)
> Maybe we should be more clear that we actually supports two types of
> options, atomic/docker related options and IdM installer options and
> explicitly mention that --hostname is ignored in case when used as installer
> option.

The document now lists two types of options: Atomic options and Identity Management installer options ("Before You Start" in the installation procedures).

--hostname being ignored when used as an installer option is now documented in the installation procedures: "Because --hostname is considered an Atomic option in this case, not an Identity Management installer option, use it before the ipa-replica-install option. The installation ignores --hostname when used after ipa-replica-install."

> 
> Maybe would be nice to add ipa-server-install into examples and just say
> that this is default operation and may be ommited

A splendid idea! Done, for example: "atomic install rhel7/ipa-server publish --hostname fully_qualified_domain_name ipa-server-install"

I also added the syntax (comment#2) in the boxes for installation command examples. It shows that ipa-server-install is an optional component.

> 
> Also I found that examples with ipa-replica-install have wrong position of
> --hostname option

Fixed -- I checked all occurrences of --hostname, and it's always shown before ipa-server-install or ipa-replica-install.
Comment 8 Aneta Šteflová Petrová 2017-08-23 03:26:19 EDT
This update was published last week: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html-single/using_containerized_identity_management_services/

All occurrences of --hostname should now be okay.

Note You need to log in before you can comment on or make changes to this bug.