On 02/17/2016 10:36 AM, Jan Pazdziora wrote: > On Wed, Feb 17, 2016 at 04:25:20PM +0100, Jan Pazdziora wrote: >> It'd be nice if the atomic command could support -h option, and make >> that value available for use in the INSTALL / RUN / UNINSTALL LABELs. >> I envision something like >> >> docker install -h ipa.example.com freeipa-server --realm EXAMPLE.COM ... >> >> and >> >> docker run freeipa-server >> >> and be able to use >> >> LABEL INSTALL 'docker run -h ${OPT_HOSTNAME} ... ${IMAGE} ...' >> >> and >> >> LABEL RUN 'docker run -h ${OPT_HOSTNAME} ... ${IMAGE} ...' >> >> and have that OPT_HOSTNAME expand to >> >> -h ipa.example.com > Dan notes that atomic run will start an existing container, so if the > user used the install to create a container with the -h flag, then > it would work properly. > > I'm not sure we can rely on this in general case. The man page > atomic-install(1) shows an example LABEL INSTALL to be > > /usr/bin/docker run -t -i --rm ... /bin/install.sh > > With that --rm, the container is removed after the install.sh finishes, > so docker run has no existing container to use. Besides, INSTALL > would typically use > > --privileged -v /:/host > > while RUN might want to run unprivileged and with a bunch of > (potentially read-only) specific directories and files bind-mounted. > > So atomic run does not start existing container -- it needs to be > able to run a new one. > Right but your install script could communicate with docker to create a container. IE You separate out the act of running the install script from the actual creation of the container.
You install.sh could execute docker create -h ipa.execample.com FOOBAR