Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap-containers: prevent bootstrap containers from restarting #1508

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/os/bootstrap-containers-tmpfiles.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
d /etc/bootstrap-containers 0750 root root -
d /run/bootstrap-containers 0755 root root -
d /local/bootstrap-containers 0700 root root -
T /local/bootstrap-containers - - - - security.selinux=system_u:object_r:secret_t:s0
6 changes: 6 additions & 0 deletions packages/os/bootstrap-containers@.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ Wants=host-containers.service
# started by systemd
RefuseManualStart=true
RefuseManualStop=true
# If a sentinel file exists for this bootstrap container, it means we should skip
# since we've run this bootstrap container already.
ConditionPathExists=!/run/bootstrap-containers/%i.ran

[Service]
Type=oneshot
EnvironmentFile=/etc/bootstrap-containers/%i.env
# Create a sentinel file to mark that we've run
ExecStart=/usr/bin/touch /run/bootstrap-containers/%i.ran
# Run the bootstrap container
ExecStart=/usr/bin/host-ctr run \
--container-id='%i' \
--source='${CTR_SOURCE}' \
Expand Down