-
I'm using docker-compose, and I'm looking for a way to say "run this script after the container has come up". I don't think I can override the entrypoint since I need systemd to be there. Apologies if this has already been documented, I wasn't able to spot it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @aaomidi, if the Sysbox container has systemd in it, then the natural way to automatically run a program inside is to create a systemd service for it (just as you would on a bare-metal machine or VM). For example, you could create a Dockerfile that uses |
Beta Was this translation helpful? Give feedback.
-
By the way, in some cases having systemd inside the Sysbox container may be warranted, in others it may be a bit too heavy. There are lighter weigh alternatives such as supervisord that are a bit easier to configure, though less versatile than systemd. There is a sample Dockerfile for a Sysbox container with supervisord here. |
Beta Was this translation helpful? Give feedback.
Hi @aaomidi, if the Sysbox container has systemd in it, then the natural way to automatically run a program inside is to create a systemd service for it (just as you would on a bare-metal machine or VM).
For example, you could create a Dockerfile that uses
nestybox/ubuntu-focal-systemd
as a base image, and then copy into it a systemd unit / service that automatically starts the program you want. Refer to the systemd docs for details on how to do this.