0

Hi I'm new to FedoraCoreOs. But I'm trying a very simple probe of concept. I'm trying to load a .tar docker image into the fedora core os local registry at starup. I'm using systemd and a service which will perform the load, but I'm missing something, since the service is executed, but when I type podman images the imaget listed.

This is my unit configuration

cat etc/systemd/system/test.service

    [Unit]

    Description=My custom service



    [Service]

    Environment=PODMAN_SYSTEMD_UNIT=%n

    Restart=on-failure

    Type=oneshot

    StandardInput=null

    StandardOutput=journal

    StandardError=journal+console

    RemainAfterExit=yes

    ExecStart=/etc/rc.d/init.d/startServiceTest.sh

The script being called is

cat /etc/rc.d/init.d/startServiceTest.sh

#!/usr/bin/env bash

podman load -i /etc/files/docker.tar

When the image boots I check the status of the service and it is run ok service status output

But after that if I check podman images the docker image is not listed. Note: If I run the commands manually it works

Any ideas??

  • It looks like they loaded correctly, but you really should not run podman as root. – Michael Hampton Sep 03 '21 at 22:03
  • juum. Do you know how can I execute this service as user? – starlord-wag Sep 03 '21 at 22:05
  • Specify the user you want in the systemd unit. – Michael Hampton Sep 03 '21 at 22:08
  • Cool! Thanks for your help man – starlord-wag Sep 03 '21 at 22:58
  • An alternative to using `User=` is to use systemd user services, where you place the configuration files inside the user's home directory under _~/.config/systemd/user_. I tried it out before https://github.com/Clinical-Genomics/scout/blob/master/containers/systemd/scout.fcc (The file can be converted to the Ignition file format with the tool [butane](https://github.com/coreos/butane)). To have the user service file start automatically you also need to create an empty file _/var/lib/systemd/linger/_ – Erik Sjölund Sep 07 '21 at 05:13

1 Answers1

0

Since podman is rootless. I just added this lines to the [Service] section of the unit configuration.

User=<my target fcos machine user>
Group=<my target fcos machines group>
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972