1

I just installed AlmaLinux 9 (a Red Hat 9 clone), and setup containers with podman which is the new standard for RH9. Following some instructions online, I succesfully downloaded and ran a container as follows:

docker run -d \
  --name homeassistant \
  --privileged \
  --restart=unless-stopped \
  -e TZ=MY_TIME_ZONE \
  -v /PATH_TO_YOUR_CONFIG:/config \
  --network=host \
  ghcr.io/home-assistant/home-assistant:stable

I can confirm it's running, so now I want to setup a systemd service file to start the 'homeassistant' container on bootup. I tried to locate the container image file but I can't! I checked the locations listed in /etc/containers/storage.conf and it lists

runroot = "/run/containers/storage"
graphroot = "/var/lib/containers/storage"

But neither of these hold the container I'm running (in fact /var/lib/containers doesn't even contain a storage subdirectory). So where is the container that my docker command downloaded?


Update: I issued the command above as a temporary user, and would like to move the container from the temporary user (hass) to root user. I thought I would move the file. (But I'm happy to delete and redownload too.) As a newbie I would like to know where this container file/image/dir is located.

My goal is to create a systemd file as shown here and I think running it as root will make life easier (at least while I learn). So I need to move the container image to a different user.

I can't figure out how to list installed containers, move them (to new user), delete them, etc. The 'podmas ps -a' lists the one running container, but only high level info.

TSG
  • 1,580
  • 6
  • 26
  • 42

1 Answers1

1

Podman stores container-related files under ~/.local/share/containers/ (~ being the home directory of whichever user ran the container).

In your scenario, you can save some download time by copying that directory to root’s home directory:

sudo mkdir -p /root/.local/share
sudo cp -a ~/.local/share/containers /root/.local/share

But you’ll still need to run podman pull to make sure everything’s set up correctly.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • I checked in ~/.local/share/containers and there are only 2 subdirs, and neither matches homeassistant. Subdirs are 'cache' and 'storage', and within 'storage' looks like default folder structure only – TSG Jul 15 '23 at 17:35
  • You won’t find anything named `home-assistant`, the directories under `…/containers` use hashes as names. It’s not clear to me why you want to find the files however — you don’t need to know where things live to start your container at boot, just run your `docker run` command. – Stephen Kitt Jul 15 '23 at 17:56
  • I added more explanation to the question – TSG Jul 15 '23 at 18:03
  • @StephenKitt *It’s not clear to me why you want to find the files however* I need to know where are the container's config files – Clodoaldo Jul 24 '23 at 17:06
  • @StephenKitt There is no `.local` directory in root's home who runs the container – Clodoaldo Jul 24 '23 at 17:07
  • @Clodoaldo please [ask a new question](https://unix.stackexchange.com/questions/ask), I suspect your use case is not the same as TSG’s. – Stephen Kitt Jul 24 '23 at 17:08