cancel
Showing results for 
Search instead for 
Did you mean: 
74razor
Flight Engineer
Flight Engineer
  • 3,502 Views

Stuck on starting a rootless container...

Hoping someone can point me in the right direction with starting a rootless container on start-up. I'm following Sanders certification guide but not getting the expected results. Here are my steps:

podman login (enter RH account creds)
podman pull ubi8
podman run -dt --name rhel8 ubi8
mkdir ~/.config/systemd/user; cd ~/.config/systemd/user
podman generate systemd --name rhel8 --files
I vim into the container-rhel8.service file and change the line to read WantedBy=default.target
systemctl --user daemon-reload
loginctl enable-linger user1
systemctl --user --now enable container-rhel8.servicebut it errors out:
Job for container-rhel8.service failed because the control process exited with error code.
See "systemctl --user status container-rhel8.service" and "journalctl --user -xe" for details.

[user1@rhcsa2 user]$ journalctl --user -xe
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit UNIT has finished starting up.
--
-- The start-up result is done.
Feb 11 14:31:18 rhcsa2.exam.local systemd[6228]: Reloading.
Feb 11 14:31:18 rhcsa2.exam.local systemd[6228]: Starting Podman container-rhel8.service...
-- Subject: Unit UNIT has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit UNIT has begun starting up.
Feb 11 14:31:18 rhcsa2.exam.local systemd[6228]: container-rhel8.service: Can't open PID file /run/user/1000/containers/overlay-containers/4953d258b7b70d3b1932f1b52bdd80586da696c826e3b2dab4efd73b4ea9bed1/userdata/>
Feb 11 14:31:18 rhcsa2.exam.local podman[57698]: rhel8
Feb 11 14:31:18 rhcsa2.exam.local systemd[6228]: container-rhel8.service: Failed with result 'protocol'.
-- Subject: Unit failed
-- Defined-By: systemd

I went through this chapter and things make sense. I 'should' work... but I must be missing something. 

3 Replies
74razor
Flight Engineer
Flight Engineer
  • 3,494 Views

Ok, I think this is because I used 'systemctl --user --now enable container-rhel8.service' when the container was already running. I tried it on another VM with just 'systemctl --user enable container-rhel8.service' and it worked fine.

EmanuelHaine
Flight Engineer
Flight Engineer
  • 3,187 Views

Hey, try this:

  1. podman generate systemd --name rhel8 --files --new
  2. stop and remove the cointainer via podman command
  3. enable and start you rootless container

I hope this can help.

0 Kudos
BramMertens
Flight Engineer
Flight Engineer
  • 3,172 Views

I see you've solved this but wanted to mention that it is not necessary to add the WantedBy by hand. That is what the systemctl --user --enable does.

In my opinion the Guided Exercise: Managing Containers as Services has a better overview of the steps required than the preceding chapter.

Regards

RHCE 100-015-239
0 Kudos
Join the discussion
You must log in to join this conversation.