qemu-user-static
qemu-user-static copied to clipboard
Persistent non-exiting image
/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 ;)
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.
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.
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.