Skip to content

Commit 534f9bb

Browse files
committed
Define LABELs for atomic install/run/stop/uninstall.
1 parent 8d90a86 commit 534f9bb

13 files changed

+194
-25
lines changed

Dockerfile.centos-7

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ RUN echo LANG=C > /etc/locale.conf
1515
RUN /sbin/ldconfig -X
1616

1717
COPY init-data ipa-server-configure-first ipa-server-status-check exit-with-status ipa-volume-upgrade-* /usr/sbin/
18-
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-*
18+
COPY install.sh uninstall.sh /bin/
19+
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-* /bin/install.sh /bin/uninstall.sh
1920
COPY container-ipa.target ipa-server-configure-first.service ipa-server-upgrade.service ipa-server-update-self-ip-address.service kill-tail.service /usr/lib/systemd/system/
2021
RUN rmdir -v /etc/systemd/system/multi-user.target.wants \
2122
&& mkdir /etc/systemd/system/container-ipa.target.wants \
@@ -52,5 +53,13 @@ STOPSIGNAL RTMIN+3
5253
ENTRYPOINT [ "/usr/sbin/init-data" ]
5354
RUN uuidgen > /data-template/build-id
5455

55-
LABEL INSTALL "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} exit-on-finished"
56-
LABEL RUN "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME}"
56+
# Invocation:
57+
# docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} [ options ]
58+
59+
# For atomic, we run INSTALL --privileged but install.sh will start another unprivileged container.
60+
# We do it this way to be able to set hostname for the unprivileged container.
61+
LABEL INSTALL 'docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} -e NAME=${NAME} -e IMAGE=${IMAGE} ${IMAGE} /bin/install.sh'
62+
LABEL RUN 'docker run ${RUN_OPTS} --rm --name ${NAME} -v /var/lib/${NAME}:/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp ${IMAGE}'
63+
LABEL RUN_OPTS_FILE '/var/lib/${NAME}/docker-run-opts'
64+
LABEL STOP 'docker stop ${NAME}'
65+
LABEL UNINSTALL 'docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} ${IMAGE} /bin/uninstall.sh'

Dockerfile.centos-7-upstream

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ RUN echo LANG=C > /etc/locale.conf
1616
RUN /sbin/ldconfig -X
1717

1818
COPY init-data ipa-server-configure-first ipa-server-status-check exit-with-status ipa-volume-upgrade-* /usr/sbin/
19-
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-*
19+
COPY install.sh uninstall.sh /bin/
20+
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-* /bin/install.sh /bin/uninstall.sh
2021
COPY container-ipa.target ipa-server-configure-first.service ipa-server-upgrade.service ipa-server-update-self-ip-address.service kill-tail.service /usr/lib/systemd/system/
2122
RUN rmdir -v /etc/systemd/system/multi-user.target.wants \
2223
&& mkdir /etc/systemd/system/container-ipa.target.wants \
@@ -53,5 +54,13 @@ STOPSIGNAL RTMIN+3
5354
ENTRYPOINT [ "/usr/sbin/init-data" ]
5455
RUN uuidgen > /data-template/build-id
5556

56-
LABEL INSTALL "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} exit-on-finished"
57-
LABEL RUN "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME}"
57+
# Invocation:
58+
# docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} [ options ]
59+
60+
# For atomic, we run INSTALL --privileged but install.sh will start another unprivileged container.
61+
# We do it this way to be able to set hostname for the unprivileged container.
62+
LABEL INSTALL 'docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} -e NAME=${NAME} -e IMAGE=${IMAGE} ${IMAGE} /bin/install.sh'
63+
LABEL RUN 'docker run ${RUN_OPTS} --rm --name ${NAME} -v /var/lib/${NAME}:/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp ${IMAGE}'
64+
LABEL RUN_OPTS_FILE '/var/lib/${NAME}/docker-run-opts'
65+
LABEL STOP 'docker stop ${NAME}'
66+
LABEL UNINSTALL 'docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} ${IMAGE} /bin/uninstall.sh'

Dockerfile.fedora-23

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ RUN echo LANG=C > /etc/locale.conf
2020
RUN /sbin/ldconfig -X
2121

2222
COPY init-data ipa-server-configure-first ipa-server-status-check exit-with-status ipa-volume-upgrade-* /usr/sbin/
23-
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-*
23+
COPY install.sh uninstall.sh /bin/
24+
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-* /bin/install.sh /bin/uninstall.sh
2425
COPY container-ipa.target ipa-server-configure-first.service ipa-server-upgrade.service ipa-server-update-self-ip-address.service kill-tail.service /usr/lib/systemd/system/
2526
RUN rmdir -v /etc/systemd/system/multi-user.target.wants \
2627
&& mkdir /etc/systemd/system/container-ipa.target.wants \
@@ -57,5 +58,13 @@ STOPSIGNAL RTMIN+3
5758
ENTRYPOINT [ "/usr/sbin/init-data" ]
5859
RUN uuidgen > /data-template/build-id
5960

60-
LABEL INSTALL "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} exit-on-finished"
61-
LABEL RUN "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME}"
61+
# Invocation:
62+
# docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} [ options ]
63+
64+
# For atomic, we run INSTALL --privileged but install.sh will start another unprivileged container.
65+
# We do it this way to be able to set hostname for the unprivileged container.
66+
LABEL INSTALL 'docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} -e NAME=${NAME} -e IMAGE=${IMAGE} ${IMAGE} /bin/install.sh'
67+
LABEL RUN 'docker run ${RUN_OPTS} --rm --name ${NAME} -v /var/lib/${NAME}:/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp ${IMAGE}'
68+
LABEL RUN_OPTS_FILE '/var/lib/${NAME}/docker-run-opts'
69+
LABEL STOP 'docker stop ${NAME}'
70+
LABEL UNINSTALL 'docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} ${IMAGE} /bin/uninstall.sh'

Dockerfile.fedora-23-upstream

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ RUN echo LANG=C > /etc/locale.conf
2121
RUN /sbin/ldconfig -X
2222

2323
COPY init-data ipa-server-configure-first ipa-server-status-check exit-with-status ipa-volume-upgrade-* /usr/sbin/
24-
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-*
24+
COPY install.sh uninstall.sh /bin/
25+
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-* /bin/install.sh /bin/uninstall.sh
2526
COPY container-ipa.target ipa-server-configure-first.service ipa-server-upgrade.service ipa-server-update-self-ip-address.service kill-tail.service /usr/lib/systemd/system/
2627
RUN rmdir -v /etc/systemd/system/multi-user.target.wants \
2728
&& mkdir /etc/systemd/system/container-ipa.target.wants \
@@ -58,5 +59,13 @@ STOPSIGNAL RTMIN+3
5859
ENTRYPOINT [ "/usr/sbin/init-data" ]
5960
RUN uuidgen > /data-template/build-id
6061

61-
LABEL INSTALL "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} exit-on-finished"
62-
LABEL RUN "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME}"
62+
# Invocation:
63+
# docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} [ options ]
64+
65+
# For atomic, we run INSTALL --privileged but install.sh will start another unprivileged container.
66+
# We do it this way to be able to set hostname for the unprivileged container.
67+
LABEL INSTALL 'docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} -e NAME=${NAME} -e IMAGE=${IMAGE} ${IMAGE} /bin/install.sh'
68+
LABEL RUN 'docker run ${RUN_OPTS} --rm --name ${NAME} -v /var/lib/${NAME}:/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp ${IMAGE}'
69+
LABEL RUN_OPTS_FILE '/var/lib/${NAME}/docker-run-opts'
70+
LABEL STOP 'docker stop ${NAME}'
71+
LABEL UNINSTALL 'docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} ${IMAGE} /bin/uninstall.sh'

Dockerfile.fedora-24

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ RUN echo LANG=C > /etc/locale.conf
2525
RUN /sbin/ldconfig -X
2626

2727
COPY init-data ipa-server-configure-first ipa-server-status-check exit-with-status ipa-volume-upgrade-* /usr/sbin/
28-
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-*
28+
COPY install.sh uninstall.sh /bin/
29+
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-* /bin/install.sh /bin/uninstall.sh
2930
COPY container-ipa.target ipa-server-configure-first.service ipa-server-upgrade.service ipa-server-update-self-ip-address.service kill-tail.service /usr/lib/systemd/system/
3031
RUN rmdir -v /etc/systemd/system/multi-user.target.wants \
3132
&& mkdir /etc/systemd/system/container-ipa.target.wants \
@@ -61,5 +62,13 @@ STOPSIGNAL RTMIN+3
6162
ENTRYPOINT [ "/usr/sbin/init-data" ]
6263
RUN uuidgen > /data-template/build-id
6364

64-
LABEL INSTALL "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} exit-on-finished"
65-
LABEL RUN "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME}"
65+
# Invocation:
66+
# docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} [ options ]
67+
68+
# For atomic, we run INSTALL --privileged but install.sh will start another unprivileged container.
69+
# We do it this way to be able to set hostname for the unprivileged container.
70+
LABEL INSTALL 'docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} -e NAME=${NAME} -e IMAGE=${IMAGE} ${IMAGE} /bin/install.sh'
71+
LABEL RUN 'docker run ${RUN_OPTS} --rm --name ${NAME} -v /var/lib/${NAME}:/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp ${IMAGE}'
72+
LABEL RUN_OPTS_FILE '/var/lib/${NAME}/docker-run-opts'
73+
LABEL STOP 'docker stop ${NAME}'
74+
LABEL UNINSTALL 'docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} ${IMAGE} /bin/uninstall.sh'

Dockerfile.fedora-rawhide

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ RUN echo LANG=C > /etc/locale.conf
2121
RUN /sbin/ldconfig -X
2222

2323
COPY init-data ipa-server-configure-first ipa-server-status-check exit-with-status ipa-volume-upgrade-* /usr/sbin/
24-
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-*
24+
COPY install.sh uninstall.sh /bin/
25+
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-* /bin/install.sh /bin/uninstall.sh
2526
COPY container-ipa.target ipa-server-configure-first.service ipa-server-upgrade.service ipa-server-update-self-ip-address.service kill-tail.service /usr/lib/systemd/system/
2627
RUN rmdir -v /etc/systemd/system/multi-user.target.wants \
2728
&& mkdir /etc/systemd/system/container-ipa.target.wants \
@@ -57,5 +58,13 @@ STOPSIGNAL RTMIN+3
5758
ENTRYPOINT [ "/usr/sbin/init-data" ]
5859
RUN uuidgen > /data-template/build-id
5960

60-
LABEL INSTALL "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} exit-on-finished"
61-
LABEL RUN "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME}"
61+
# Invocation:
62+
# docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} [ options ]
63+
64+
# For atomic, we run INSTALL --privileged but install.sh will start another unprivileged container.
65+
# We do it this way to be able to set hostname for the unprivileged container.
66+
LABEL INSTALL 'docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} -e NAME=${NAME} -e IMAGE=${IMAGE} ${IMAGE} /bin/install.sh'
67+
LABEL RUN 'docker run ${RUN_OPTS} --rm --name ${NAME} -v /var/lib/${NAME}:/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp ${IMAGE}'
68+
LABEL RUN_OPTS_FILE '/var/lib/${NAME}/docker-run-opts'
69+
LABEL STOP 'docker stop ${NAME}'
70+
LABEL UNINSTALL 'docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} ${IMAGE} /bin/uninstall.sh'

Dockerfile.rhel-7

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ RUN echo LANG=C > /etc/locale.conf
1515
RUN /sbin/ldconfig -X
1616

1717
COPY init-data ipa-server-configure-first ipa-server-status-check exit-with-status ipa-volume-upgrade-* /usr/sbin/
18-
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-*
18+
COPY install.sh uninstall.sh /bin/
19+
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-* /bin/install.sh /bin/uninstall.sh
1920
COPY container-ipa.target ipa-server-configure-first.service ipa-server-upgrade.service ipa-server-update-self-ip-address.service kill-tail.service /usr/lib/systemd/system/
2021
RUN rmdir -v /etc/systemd/system/multi-user.target.wants \
2122
&& mkdir /etc/systemd/system/container-ipa.target.wants \
@@ -50,5 +51,13 @@ STOPSIGNAL RTMIN+3
5051
ENTRYPOINT [ "/usr/sbin/init-data" ]
5152
RUN uuidgen > /data-template/build-id
5253

53-
LABEL INSTALL "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} exit-on-finished"
54-
LABEL RUN "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME}"
54+
# Invocation:
55+
# docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} [ options ]
56+
57+
# For atomic, we run INSTALL --privileged but install.sh will start another unprivileged container.
58+
# We do it this way to be able to set hostname for the unprivileged container.
59+
LABEL INSTALL 'docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} -e NAME=${NAME} -e IMAGE=${IMAGE} ${IMAGE} /bin/install.sh'
60+
LABEL RUN 'docker run ${RUN_OPTS} --rm --name ${NAME} -v /var/lib/${NAME}:/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp ${IMAGE}'
61+
LABEL RUN_OPTS_FILE '/var/lib/${NAME}/docker-run-opts'
62+
LABEL STOP 'docker stop ${NAME}'
63+
LABEL UNINSTALL 'docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} ${IMAGE} /bin/uninstall.sh'

Dockerfile.rhel-7-upstream

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ RUN echo LANG=C > /etc/locale.conf
1616
RUN /sbin/ldconfig -X
1717

1818
COPY init-data ipa-server-configure-first ipa-server-status-check exit-with-status ipa-volume-upgrade-* /usr/sbin/
19-
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-*
19+
COPY install.sh uninstall.sh /bin/
20+
RUN chmod -v +x /usr/sbin/init-data /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-server-status-check /usr/sbin/exit-with-status /usr/sbin/ipa-volume-upgrade-* /bin/install.sh /bin/uninstall.sh
2021
COPY container-ipa.target ipa-server-configure-first.service ipa-server-upgrade.service ipa-server-update-self-ip-address.service kill-tail.service /usr/lib/systemd/system/
2122
RUN rmdir -v /etc/systemd/system/multi-user.target.wants \
2223
&& mkdir /etc/systemd/system/container-ipa.target.wants \
@@ -51,5 +52,13 @@ STOPSIGNAL RTMIN+3
5152
ENTRYPOINT [ "/usr/sbin/init-data" ]
5253
RUN uuidgen > /data-template/build-id
5354

54-
LABEL INSTALL "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} exit-on-finished"
55-
LABEL RUN "docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME}"
55+
# Invocation:
56+
# docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /opt/ipa-data:/data:Z -h ipa.example.test ${NAME} [ options ]
57+
58+
# For atomic, we run INSTALL --privileged but install.sh will start another unprivileged container.
59+
# We do it this way to be able to set hostname for the unprivileged container.
60+
LABEL INSTALL 'docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} -e NAME=${NAME} -e IMAGE=${IMAGE} ${IMAGE} /bin/install.sh'
61+
LABEL RUN 'docker run ${RUN_OPTS} --rm --name ${NAME} -v /var/lib/${NAME}:/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp ${IMAGE}'
62+
LABEL RUN_OPTS_FILE '/var/lib/${NAME}/docker-run-opts'
63+
LABEL STOP 'docker stop ${NAME}'
64+
LABEL UNINSTALL 'docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} ${IMAGE} /bin/uninstall.sh'

README

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ address. Starting the server would then be
9999
-p 88:88/udp -p 464:464/udp -p 123:123/udp -p 7389:7389 \
100100
-p 9443:9443 -p 9444:9444 -p 9445:9445 ...
101101

102+
# Configuring and running with atomic
103+
104+
On platforms with `atomic` command available, the container can be
105+
configured with
106+
107+
atomic install freeipa-server --hostname ipa.example.test [opts]
108+
109+
It will use /var/lib/freeipa-server to store the configuration
110+
and data. The container then gets started with
111+
112+
atomic run freeipa-server
113+
114+
Version 1.12 of atomic is needed.
102115

103116
# IPA-enrolled client in Docker
104117

init-data

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ set -e
2121

2222
cd /
2323

24+
case "$1" in
25+
/bin/install.sh|/bin/uninstall.sh|/bin/bash|bash)
26+
exec "$@"
27+
;;
28+
esac
29+
2430
if ls -dZ /sys/fs/cgroup | grep -q :svirt_sandbox_file_t: ; then
2531
echo "Invocation error: use -v /sys/fs/cgroup:/sys/fs/cgroup:ro parameter to docker run." >&2
2632
exit 9

install.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [ -z "$DATADIR" -o -z "$HOST" ] ; then
6+
echo "Not sure where FreeIPA data should be stored." >&2
7+
exit 1
8+
fi
9+
10+
if [ -f "$HOST$DATADIR"/etc/ipa/default.conf ] ; then
11+
echo "FreeIPA seems already initialized in [$DATADIR]." >&2
12+
exit 1
13+
fi
14+
15+
mkdir -p "$HOST$DATADIR"
16+
17+
HOSTNAME_PARAM=
18+
19+
i=0
20+
while [[ $i -lt $# ]] ; do
21+
case "${!i}" in
22+
--hostname)
23+
i=$(( i + 1 ))
24+
HOSTNAME_PARAM="${!i}"
25+
;;
26+
--hostname=*)
27+
HOSTNAME_PARAM="${!i%%--hostname=}"
28+
;;
29+
esac
30+
i=$(( i + 1 ))
31+
done
32+
33+
if [ -z "$HOSTNAME_PARAM" ] ; then
34+
NAME_PARAM=''
35+
if [ -n "$NAME" ] ; then
36+
NAME_PARAM=" --name $NAME"
37+
fi
38+
echo "Please specify the hostname for the server with --hostname parameter." >&2
39+
echo "Usage: atomic install$NAME_PARAM $IMAGE --hostname FQDN.of.the.IPA.server" >&2
40+
exit 1
41+
fi
42+
43+
echo "--hostname=$HOSTNAME_PARAM" > "$HOST$DATADIR"/docker-run-opts
44+
echo "$HOSTNAME_PARAM" > "$HOST$DATADIR"/hostname
45+
46+
chroot "$HOST" /usr/bin/docker run -ti --rm \
47+
-e NAME="$NAME" -e IMAGE="$IMAGE" \
48+
-v "$DATADIR":/data:Z -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp -h "$HOSTNAME_PARAM" "$IMAGE" exit-on-finished "$@"

ipa-server-configure-first

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ else
179179
HOSTNAME_SHORT=${HOSTNAME%%.*}
180180
DOMAIN=${HOSTNAME#*.}
181181
if [ "$HOSTNAME_SHORT.$DOMAIN" != "$HOSTNAME" ] ; then
182-
usage
182+
usage "The container has to have fully-qualified hostname defined."
183183
fi
184184

185185
STDIN=/dev/stdin

uninstall.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Copyright 2016 Jan Pazdziora
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# Uninstallation for atomic uninstall.
18+
19+
set -e
20+
21+
if [ -z "$DATADIR" -o -z "$HOST" ] ; then
22+
echo "Not sure where FreeIPA data is stored." >&2
23+
exit 1
24+
fi
25+
26+
TARGET=$( date '+%Y%m%d-%H%M%S' )
27+
mv "$HOST/$DATADIR" "$HOST/$DATADIR.backup.$TARGET"
28+
echo "Moved [$DATADIR] aside to [$DATADIR.backup.$TARGET]."
29+
30+
exit 0

0 commit comments

Comments
 (0)