Sharing Ilmu

Sharing for useful things

How To Configure autostart container host with user system

In this tutorial I’ll explain about configure autostart for container host so that those container can start automatically when the system power on with creating systemd user unit files. With use of user service can be start container automatically when you open first session throught CLI or GUI and stop the service when session close and running with non-root user.  The behavior can be change so that the service start automatically when your system power on and stop when your system shutdown using loginctl enable-linger command and then you must create unit files for your systemd user service.

First you must run container host for http or database in preceding tutorials in Configure Persistent Storage web server  and Configure Persistent Storage Database .

In this tutorial I’ll try automatic start with http web server container host.

This container that have run in this tutorial

After that, do configure for autostart container.

Activate linger

$ systemctl enable-linger

Show user for check linger status

$ systemctl show-user taufik

Now create Systemd user system unit files. create new directory in .config/systemd/user and then change working directory to systemd/user.

Generate systemd unit files for mywebsite container host.

Enable and start unit file for container mywebsite

Reboot your system.

After reboot then check podman that are running with podman ps command

As the showing image above, the container host automatically started when system power on or when system reboot.


Leave a Reply

Your email address will not be published. Required fields are marked *.

You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>