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

Persistent non-exiting image #160

Open
JuniorJPDJ opened this issue Dec 12, 2021 · 3 comments
Open

Persistent non-exiting image #160

JuniorJPDJ opened this issue Dec 12, 2021 · 3 comments

Comments

@JuniorJPDJ
Copy link

/kind enhancement

Hi!
If you could provide register image which would sleep forever or something, but when docker daemon is restarted it would also re-register, so it can re-register automagically after a reboot it would be amazing.
(The main point is re-register after reboot)

This could help much with unattended CI runners to build multiarch images ;)

@martin-g
Copy link

I am not sure that Docker(daemon) provides such functionality.
You should use OS service (like systemd) to run the image with your preferred arguments.

@sdarwin
Copy link

sdarwin commented Jan 11, 2022

What's the best way to handle reboots?

In a standard scenario, the following command must be run after a reboot or else multi-arch containers won't run.

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

It could be logical to create a simple systemd service which runs that command:

/etc/systemd/system/multiarch-qemu-user-static.service :

[Unit]
Description=multiarch-qemu-user-static

[Service]
ExecStart=/usr/bin/docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

[Install]
WantedBy=multi-user.target

and

sudo systemctl enable multiarch-qemu-user-static.service
sudo systemctl daemon-reload
sudo systemctl start multiarch-qemu-user-static.service

However, as an alternative idea, the README mentions certain flags --systemd, --debian, --exportdir and the host system has services such as systemd-binfmt.service. Would it be more correct to follow a procedure with those flags (--systemd, --debian, --exportdir), and generate qemu config files that would get processed at boot time? If so, what are the exact steps to run on Debian or Redhat? If not... the text "boot" or "reboot" doesn't appear in the README file, but it would be helpful to add some information about it.

@JuniorJPDJ
Copy link
Author

Re-registering after reboot could just be handled by container image run with restart: unless-stopped and make container image not shutdown itself after initialization. Then reboot will shut down docker daemon and restart it after reboot, it will start container again and container will reregister binfmt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants