Podman: set podman image storage location

Created on 2 Dec 2018  Â·  19Comments  Â·  Source: containers/podman

or, rather, support request.

My root is mounted at SSD for speed, and so does my home. However, I am not rich, so SSD is small, and now I want more space. First I want to move images to another disk, and if that won't help, move containers as well.

I found podman info, which printed some useful info at the end.

...
store:
  ContainerStore:
    number: 3
  GraphDriverName: vfs
  GraphOptions: []
  GraphRoot: /home/anatoli/.local/share/containers/storage
  GraphStatus: {}
  ImageStore:
    number: 1
  RunRoot: /run/user/1000/run

The path /home/anatoli/.local/share/containers/storage is 6.3G, and there is only one image 745Mb in size there.

✗ podman images -a
REPOSITORY                 TAG     IMAGE ID       CREATED        SIZE
docker.io/library/golang   1.9.4   a6c306bd0b2f   8 months ago   754MB
✗ du -hs  ~/.local/share/containers/storage
6.3G    /home/anatoli/.local/share/containers/storage

I don't see how can I move images to the other place, because vfs-images contains only meta information and vfs hosts only hash dirs.

6.3G    /home/anatoli/.local/share/containers/storage/vfs
132K    /home/anatoli/.local/share/containers/storage/vfs-containers
28K /home/anatoli/.local/share/containers/storage/vfs-images
1.8M    /home/anatoli/.local/share/containers/storage/vfs-layers

Is there a setting that I can change to store images in a separate dir?

Output of podman version:

Version:       0.10.1.3
Go Version:    go1.10.4
OS/Arch:       linux/amd64

Most helpful comment

SImpler fix would be to setup a bind mount
cp -R ~/.local/share/containers /data
rm -rf ~/.local/share/containers
mkdir ~/.local/share/containers
mount -o bind /data/containers ~/.local/share/containers

All 19 comments

You can make a copy of /etc/containers/storage.conf in ~/.config/containers
(this directory may need to be created first) and configure where rootless
Podman stores things in that file. Be aware that, if you change these
directories, it's recommended that you delete the old ones (you may end up
with an unusable Podman otherwise).

It sounds like you'll want to change the graph root directory, where
permanent files and container images are stored. Start by changing graph
driver to the rootless default (vfs) and run root to a directory in
/run/user/$YOUR_UID/ (this directory does not need to exist, we'll create
it if it doesn't). Then set the graph root to a location where your user
has write access, and all container and image permanent files will be
stored at that location.

On Sun, Dec 2, 2018, 07:40 Anatoli Babenia <[email protected] wrote:

[//]: # kind feature

or, rather, support request.

My root is mounted at SSD for speed, and so does my home. However, I am
not rich, so SSD is small, and now I want more space. First I want to move
images to another disk, and if that won't help, move containers as well.

I found podman info, which printed some useful info at the end.

...

store:

ContainerStore:

number: 3

GraphDriverName: vfs

GraphOptions: []

GraphRoot: /home/anatoli/.local/share/containers/storage

GraphStatus: {}

ImageStore:

number: 1

RunRoot: /run/user/1000/run

The path /home/anatoli/.local/share/containers/storage is 6.3G, and there
is only one image 745Mb in size there.

✗ podman images -a

REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/golang 1.9.4 a6c306bd0b2f 8 months ago 754MB

✗ du -hs ~/.local/share/containers/storage

6.3G /home/anatoli/.local/share/containers/storage

I don't see how can I move images to the other place, because vfs-images
contains only meta information and vfs hosts only hash dirs.

6.3G /home/anatoli/.local/share/containers/storage/vfs

132K /home/anatoli/.local/share/containers/storage/vfs-containers

28K /home/anatoli/.local/share/containers/storage/vfs-images

1.8M /home/anatoli/.local/share/containers/storage/vfs-layers

Is there a setting that I can change to store images in a separate dir?

Output of podman version:

Version: 0.10.1.3

Go Version: go1.10.4

OS/Arch: linux/amd64

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/containers/libpod/issues/1916, or mute the thread
https://github.com/notifications/unsubscribe-auth/AHYHCKfbXbszilQURUZo7R-wUPFUP6a9ks5u08opgaJpZM4Y9Yi-
.

Sounds like podman doesn't support changing image storage location with a simple user setting. Does that qualify for a future request? Having an option in ~/.config/containers/storage.conf- ImageStore.location = /data/podman-image.

We are moving over to creating the file by default, with the correct settings (so you'll only need to swap the one setting). That should be out in our next release (hopefully tomorrow). If you're looking for a way to just swap image storage, though, I don't think that's possible as of now - we storage images and containers in the same place as part of the architecture of containers/storage. We might be able to split that, but for now both must be in the same place.

Let me know what should I do when it is released. I guess removing podman, cleaning up config files and then reinstalling it again to create the config in my home dir? Then I will be able to edit it to set storate location.

SImpler fix would be to setup a bind mount
cp -R ~/.local/share/containers /data
rm -rf ~/.local/share/containers
mkdir ~/.local/share/containers
mount -o bind /data/containers ~/.local/share/containers

+1 for the file based configuration of the storage location.

With podman 0.12.1.1 It should generate ~/.lcontig/containers/storage.conf
This file can be edited to point at /data/containers.

~/.config/containers/storage.conf to be clear

➜  ~ rm -rf ~/.local/share/containers
➜  ~ rm -rf ~/.config/containers
➜  ~ sudo dnf --enablerepo=updates-testing install podman
...
podman                            x86_64       0.12.1.1-1.git66d3499.fc28        updates-testing       7.0 M
➜  ~ cat .config/containers/storage.conf 
[storage]
  driver = "vfs"
  runroot = "/run/user/1000"
  graphroot = "/home/anatoli/.local/share/containers/storage"
  [storage.options]
    mount_program = ""

It's not really clear from the generated file, but graphroot there is container and image storage

@mheon you're right that it's not clear... not sure if the generated ~/.config/containers/storage.conf can include comment/documentation. That alone would help a lot.

It could, but it would be a fair bit of effort on our end (straight TOML generation to templated output). Probably worth it, though.

Looks like Tom doesn't count comments as a feature - https://github.com/toml-lang/toml/issues/284

@giuseppe I think your code is doing this, could you take a look.

How often does podman touch storage folder while sitting in a background and not starting other containers? Is there a way to measure that?

You'd need to change both storage.conf and libpod.conf to update the path to static dir.

Migration is currently blocked by us validating the config file settings with the db.

It should work if you start with a fresh storage

If migration is impossible, then the only way is remove podman, then edit files

vim $HOME/.config/containers/libpod.conf
# volume_path = "$HOME/.local/share/containers/storage/volumes"
# static_dir = "$HOME/.local/share/containers/storage/libpod"
vim $HOME/.config/containers/storage.conf
# [storage]
#   graphroot = "$HOME/.local/share/containers/storage"

, kill $HOME/.local/share/containers, and install podman again.

why do you need to remove podman and install it again?

I believe this is no longer an issue.

Was this page helpful?
0 / 5 - 0 ratings