Introduction
A containerized application service has several layers: the systemd unit, the wrapper command, the image reference, the container runtime, and the application output. A bad image tag can make the service fail before the application starts.
In this lab, rhce-container-app.service uses Podman to run a UBI 10 minimal container. The correct image is already pulled, but the service environment file points to a bad tag. You will diagnose the failure, repair the image tag, restart the service, and verify the running container.
Confirm the Container Service Failure
In this step, you will inspect the failed systemd unit before changing the container configuration.
Move into the project directory and create a workspace.
cd /home/labex/project
mkdir -p container-service
Check the service state.
systemctl is-failed rhce-container-app.service || true
Save selected service properties.
systemctl show rhce-container-app.service -p ActiveState -p Result -p ExecMainStatus | tee container-service/service-state.txt
Read recent service logs.
sudo journalctl -u rhce-container-app.service -n 20 --no-pager
The service fails before the application creates its ready file.
Inspect Images and the Environment File
In this step, you will compare the image available locally with the image tag used by the service.
List local images.
sudo podman images | tee container-service/images.txt
Read the service environment file.
sudo cat /etc/rhce-container/app.env | tee container-service/env-before.txt
Show the wrapper command.
sudo sed -n '1,16p' /usr/local/bin/rhce-container-run
The local image tag is latest, but the service points to missing.
Repair the Image Tag
In this step, you will update only the service environment file so it uses the pulled image tag.
Replace the bad tag.
sudo sed -i 's/:missing/:latest/' /etc/rhce-container/app.env
Save the repaired environment.
sudo cat /etc/rhce-container/app.env | tee container-service/env-after.txt
The service now points to the image that exists locally.
Restart the Container Service
In this step, you will clear the failed state and restart the systemd-managed container.
Reset the failed state.
sudo systemctl reset-failed rhce-container-app.service
Restart the service.
sudo systemctl restart rhce-container-app.service
Save the active state.
systemctl is-active rhce-container-app.service | tee container-service/service-final.txt
The service should now stay active because Podman can use the corrected image.
Verify the Running Container
In this step, you will check Podman and the application ready file.
List the running container.
sudo podman ps --filter name=rhce-container-app --format "{{.Names}} {{.Status}}" | tee container-service/container-state.txt
Read the ready file created by the container.
cat /srv/rhce-container/ready.txt | tee container-service/ready.txt
The containerized service is running and has produced its expected output.
Summary
You diagnosed a failed systemd-managed Podman service, compared the available image with the configured image tag, repaired the environment file, restarted the service, and verified the running container and application ready file.



