Commit Graph

5664 Commits

Author SHA1 Message Date
Miloslav Trmač fc19c49e20 When applying a chunked layer with a tar-split, compute its uncompressed digest
This will allow c/image to validate the uncompressed digest against the config's
RootFS.DiffID value (ensuring that the layer's contents are the same when pulled
via TOC and traditionally); and the uncompressed digest will be used as a layer ID,
ensuring users see the traditional layer and image IDs they are used to.

This doesn't work for layers without a tar-split (all estargz, and old zstd:chunked
layers); for those, we fall back to traditional pulls.

Alternatively, for EXTREMELY restricted use cases, add an
"insecure_allow_unpredictable_image_contents" option to storage.conf. This option
allows partial pulls of estargz and old zstd:chunked layers, and skips the costly
uncompressed digest computation. It is then up to the user to worry about
images where the tar representation and the TOC representation don't match,
and about unpredictable image IDs.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-07 16:56:09 +01:00
Giuseppe Scrivano 179437f65c containers-storage: new command 'dedup'
introduce a new `dedup` command to the `containers-storage` tool to
deduplicate similar files in image layers.  Reflinks support from the
underlying file system is needed.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-12-09 16:41:59 +01:00
Nalin Dahyabhai 0763f952c0 Disable partial pulls (zstd:chunked) by default
Disable the storage.options.pull_options.enable_partial_images option by
default, so that it will have to be explicitly enabled in order to be
used.

Update the apply-diff-from-staging-directory integration test to call
the test helper binary directly, so that the configuration file the test
writes won't have its settings overridden by command line options that
the storage() test helper function adds.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-11-04 13:52:48 -05:00
Colin Walters 397fcf805f Sync man page with storage.conf
xref https://github.com/containers/storage/pull/2065#issuecomment-2313002081

This does the same for the man page that I did for the default
storage.conf previously; instead of trying to squash all the
`pull_options` into a single option that we document "ad-hoc", make
it its own table just like the other sections.

- Add notes about "string bools" around relevant values.
- Avoid redundantly specifying the default; the default is the first
  thing we show after the `=`.

Synchronize the text between the man page and the default
`storage.conf`.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-08-27 14:41:22 -04:00
Colin Walters 0c2dda67ed docs: Fill in more about composefs and zstd:chunked
I've been reading more of the code and looking
at the filesystem in these modes.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-08-22 15:22:22 -04:00
Colin Walters b1bb568e7a storage.conf: Various cleanups
The default storage.conf we ship is inconsistent in a few ways;
there's a lot of fixes rolled up into this single commit.

First: we were using a toml "inline table" for the pull options,
and then documenting each key in that table in one blob above.
It simply looks much nicer to use a non-inline table - then
we can move the docs next to each individual value. This is also
more consistent with other sections of the config.

I also thinned out a bit the doc comments; I think instead of trying
to have a longer explanation of zstd:chunked in the comments here
we should refer to the man page, which is a better place to have
details (and that we should fill out more).

Per another PR, I also stumbled across the fact that we have a
lot of "string bool" values and cannot be native TOML booleans. Document
that clearly next to each type.

We already have default values in the *code* for all
of these, so comment them all out to be consistent with other
values. (We're then getting closer to having the config file
be entirely comments, but that's a distinct project)

Finally, update the recent man pages I added to match
these changes.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-08-17 14:08:26 +00:00
Colin Walters afa686b8c7 docs: Add (not installed) man pages for composefs and zstd:chunked
These aren't installed yet so they'll just live in the git repository
but hopefully we can expand them and use them as a central reference
point for "how do I do (zstd:chunked)|(composefs)". We have copies
of that kind of instruction in other downstream places but
I think here makes the most sense.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-08-04 17:21:04 -04:00
Giuseppe Scrivano 9ced4406a7 store: drop remap-[ug]ids
drop the possibility to configure a remapping for all the layers in
the storage.

The feature dates back to the initial fork from Docker, that supported
a single user namespace where all the images were pulled. It was never
used by the container tools since we have a finer control of the user
namespaces.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-06-24 13:15:04 +02:00
Kir Kolyshkin 1caec4ab84 Remove devicemapper storage driver
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-04-15 14:44:29 -07:00
Ed Baunton 4e34171330 Synchronise documentation for convert_images flag
Synchronise documentation around the configuration file to accurately
reflect new `convert_images` flag.

Signed-off-by: Ed Baunton <edbaunton@gmail.com>
2024-02-16 06:17:01 -05:00
Giuseppe Scrivano 7b0cf758f2 storage: enable partial images by default
by default enable pulling a partial image, it is still possible to
disable the feature through the configuration file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-02-15 21:58:57 +01:00
Nalin Dahyabhai 2347d7d39f Store: add ImageDirectory() and ImageRunDirectory()
Add ImageDirectory() and ImageRunDirectory(), which return the paths of
directories which the caller can use to store image-specific data which
will be cleaned up automatically when the image is removed or the system
is restarted, respectively.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-01-23 14:35:01 -05:00
Giuseppe Scrivano e794b019f6 config: new option use_composefs
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-12-11 15:06:41 +01:00
Giuseppe Scrivano 34adca1df4 docs: document convert_images
Closes: https://github.com/containers/storage/issues/1749

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-11-06 11:15:42 +01:00
Giuseppe Scrivano e2b9a7719d cmd: add applydiff-using-staging-dir
add a new command to exercise the ApplyDiff from a staging directory.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-10-03 09:38:44 +02:00
Daniel J Walsh 86cd795ff2 Run codespell on code
Cleanup description of imagestore.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-09-15 06:16:12 -04:00
Kevin Hannon 7a9a60eeb8 add documentation on imagestore and add a warning if set
Signed-off-by: Kevin Hannon <kehannon@redhat.com>
2023-08-28 10:35:41 -04:00
Toshiki Sonoda 84ca71cf0a options: enable Remap-User/Group setting
Remap-User/Group setting is always override by
Remap-UIDs/GIDs setting and ignored.

This commit enables Remap-User/Group setting.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-05-26 15:42:26 +09:00
Daniel J Walsh 066096180c Merge pull request #1611 from sstosh/typo-conf
Fix typo in storage.conf
2023-05-25 07:03:21 -04:00
Toshiki Sonoda 9ce21096e1 Fix typo in storage.conf
- remap-uids and remap-gids requires a string data type.
- "four keys" -> "three keys"
- "minimum" -> "maximum"

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-05-25 14:45:18 +09:00
Kir Kolyshkin e81a0554c8 docs/Makefile: add missing phony targets
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2023-05-23 17:56:03 -07:00
Daniel J Walsh 263b07b6e4 Merge pull request #1549 from flouthoc/pull-store
store: add support to split filesystem using `imagestore`
2023-04-17 16:55:03 -04:00
Aditya R fe64c4e56c store: add support to split ImageStore
Allow storage users to split the filesystem of containers vs image
store, `imagestore` if configured will pull images in image storage
instead of the `graphRoot` while keeping the other parts still in the
originally configured `graphRoot`.

overlay: set workdir and upperdir according to splitstore
If splitstore is set `workdir` and `upperdir` must go into the
splitstore i.e `graphRoot`.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-04-14 17:34:27 +05:30
Nalin Dahyabhai 92c4efc26e Initial implementation of consistency checks
Add initial Check() and Repair() methods to Stores.

Check() checks for inconsistencies between the layers which the
lower-level storage driver claims to know about and the ones which we
know we're managing.  It checks that layers referenced by layers,
images, and containers are known to us and that images referenced by
containers are known to us.  It checks that data which we store
alongside layers, images, and containers is still present, and to the
extent which we store other information about that data (frequenly just
the size of the data), verifies that it matches recorded expectations.
Lastly, it checks that layers which are part of images (and which we
therefore know what they should have in them) have the expected content,
and nothing else.

Repair() removes any containers, images, and layers which have any
errors associated with them.  This is destructive, so its use should be
considered and deliberate.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2023-04-13 10:38:24 -04:00
Nalin Dahyabhai f169774db9 Test helper: add "unshare"/"create-storage-layer"/"storage-layers"
Add "unshare", "create-storage-layer", and "storage-layers" commands to
the test helper, along with a "-U" flag to have it unshare when handling
a given command.

Add "-o" as an alias for the "--owner" flag to "copy".

Add "-r" as an alias for the "--ro" flag to "mount".

Add a "-q" flag to "layers" so that we can list just the IDs.

Drop mention of a couple of not-implemented options from
docs/containers-storage-create-layer.md.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2023-04-10 10:23:23 -04:00
Nalin Dahyabhai 99e67c6aab Complete "pulling up" of images in updateNames()
When updateNames() copies an image's record from a read-only store into
the read-write store, copy the accompanying data as well.

Add fields for setting data items at creation-time to LayerOptions,
ImageOptions, and ContainerOptions to make this easier for us and our
consumers.

Replace the store-specific Create() (and the one CreateWithFlags() and
Put()) with private create() and put() methods, since they're not
intended for consumption outside of this package, and add Flags to the
options structures we pass into those methods.  In create() methods,
make copies of those passed-in options structures before modifying any
of their contents.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2023-03-31 10:36:30 -04:00
Daniel J Walsh 5a14727093 Document transient_store in man page
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-03-31 05:36:06 -04:00
Daniel J Walsh a755750739 Run codespell on codebase
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-02-09 12:27:59 -05:00
Nalin Dahyabhai d5136edf4a cmd: add a CLI wrapper for GarbageCollect
Add "gc" as an action for the CLI wrapper, for running the
GarbageCollect() method.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2023-01-26 16:09:00 -05:00
Dan Čermák fc31722143 Make the priority for picking the storage driver configurable
This fixes https://github.com/containers/storage/issues/1457

Co-authored-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Dan Čermák <dcermak@suse.com>
2023-01-05 12:38:33 +01:00
Jack Henschel bd7f1aa83c Fix minor typo on containers-storage.conf.5.md
Signed-off-by: Jack Henschel <jack.henschel@cern.ch>
2022-11-28 18:04:24 +01:00
Nalin Dahyabhai cdc2f417fd Revert incorrect "heeded" -> "needed" typo fix
A recent typo fix introduced a typo.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2022-09-15 15:18:51 -04:00
Дилян Палаузов c1dcd27440 docs/containers-storage.conf.5.md: reformat
Insisting on “DCO” imposes formalities, that serve self-purpose.  One cannot
assume that the submitter has time or will to read texts about symbolism in
software contributions.  If the system wants to see the text

  nrEAUIEUAIe eanuitdnuae EAIUEAUIAIE »ℓ§444.3.72b)°»°ℓ§euaieauuae

in each commit, people will write this, or any other text, that the system wants to
see.  All such text, which presence is mandated by the system, has the same value.

Signed-off-by: Дилян Палаузов <git-dpa@aegee.org>
2022-08-31 17:54:53 +03:00
Erik Sjölund e3ac6ed4ad fix typos and spelling
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2022-07-27 21:39:12 +02:00
Daniel J Walsh 82249805ff Move skip_mount_home to overlay specific flag in man page
Fixes: https://github.com/containers/storage/issues/1259

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-06-14 14:45:41 -04:00
Giuseppe Scrivano e0cdfa41a6 chunked: drop host dedup feature
drop host deduplication by just looking at the file path.  It could be
useful in very specific use cases, but it is too expensive for generic
images.  If the need arises, we first need to create an index of the
files that we can deduplicate so there is no need to calculate the
checksum on the fly.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-06-07 15:32:34 +02:00
Daniel J Walsh 2290f8117b Document the pull_options
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-18 15:21:03 -04:00
Daniel J Walsh ad6b888dd1 Clearup inheritance rules for storage.conf
We have had cases where users assume that create a storage.conf file in
their home directory, will still inherit fields from the system
storage.conf files. Need to clear this up in the storage.conf file and
man page.

Fixes: https://github.com/containers/podman/issues/11778

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-03 08:30:26 -04:00
Daniel J Walsh 4d34582f5e Add data about relabeling homedir
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-10-18 15:26:46 -04:00
Daniel J Walsh 04974a4fbd Tell users who change graphroot location to fix the SELinux labels
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-10-06 14:44:30 -04:00
Daniel J Walsh 27cf58536b Fix handling of quota on volumes
This patch fixes the handling of inodes and sizes, currently if
user sets indoes and sizes together, quota is only set on sizes.

Second problem with quota is that we have to have unigue projectids
for each directory. Originally container/storage only did quota on
rootfs, now we want to support it on volumes as well. We need to be
able to get unigue projectids for these two different parent
directories. The added function, attempts to maintain at least 10,000
unigue id's based on the inode of the parent directory. I know that this
is not perfect and we have a potential for overlay.  If you have a
better algorythm, I would love to use it.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-30 05:56:23 -04:00
Daniel J Walsh 352d13eee2 Update docs/containers-storage.conf.5.md
Co-authored-by: Nalin Dahyabhai <nalin@redhat.com>
2021-07-26 10:01:33 -04:00
Daniel J Walsh 57c870e3bb Update docs/containers-storage.conf.5.md
Co-authored-by: Nalin Dahyabhai <nalin@redhat.com>
2021-07-26 10:01:12 -04:00
Daniel J Walsh f0a3824ba9 Add inode support to quota
quota for overlay also supports setting the maximum number of
inodes. OpenShift would like to be able to set this to control the
number of inodes added to an image or to a volume.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-26 06:29:40 -04:00
mla ea005eeabd Added support for CONTAINERS_STORAGE_CONF override
Signed-off-by: Morten Larsen <mortenlarsens@gmail.com>
2021-06-09 10:17:09 +02:00
Daniel J Walsh 6a9970564a Update docs/containers-storage.conf.5.md
Co-authored-by: Tom Sweeney <tsweeney@redhat.com>
2021-05-17 13:39:49 -04:00
Giuseppe Scrivano d2b6decf95 store: add option to disable volatile
add an option to storage.options to inhibit usage of the
volatile storage flag.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-05-17 09:51:52 +02:00
Jordan Williams cd2b12b293 Inherit system storage driver in rootless configurations
The storage driver set in `/etc/containers/storage.conf` was ignored for rootless configurations.
Rootless configurations would use overlay or vfs by default.
If the STORAGE_DRIVER environment was variable set, this value would be used instead.

This commit changes this behavior to inherit the driver set in `/etc/containers/storage.conf`.
To inherit the driver in rootless configurations, the driver must be valid in a rootless context.
The valid rootless drivers are btrfs, overlay, and vfs at this time.
To remain consistent with previous behavior, the STORAGE_DRIVER environment variable supersedes any driver set in `/etc/containers/storage.conf` and does not need to be a valid rootless driver.

buildah's documentation for the `--storage-driver` command will need to be updated to reflect these changes.
2021-03-02 10:28:53 -06:00
Giuseppe Scrivano 6513bb3530 containers-storage: support layer bigdata
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-02-02 11:39:03 +01:00
Daniel J Walsh 3e9e27b301 Switch references of /var/run -> /run
Systemd is now complaining or mentioning /var/run as a legacy directory.
It has been many years where /var/run is a symlink to /run on all
most distributions, make the change to the default.

Partial fix for https://github.com/containers/podman/issues/8369

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-18 06:32:45 -05:00