From 8f6a0243f4b7f861a116c0dba5967b3cfe23d61f Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 1 Jul 2021 15:24:20 +0200 Subject: podman diff accept two images or containers First, make podman diff accept optionally a second argument. This allows the user to specify a second image/container to compare the first with. If it is not set the parent layer will be used as before. Second, podman container diff should only use containers and podman image diff should only use images. Previously, podman container diff would use the image when both an image and container with this name exists. To make this work two new parameters have been added to the api. If they are not used the previous behaviour is used. The same applies to the bindings. Fixes #10649 Signed-off-by: Paul Holzinger --- docs/source/markdown/links/podman-container-diff.1 | 1 - docs/source/markdown/podman-container-diff.1.md | 54 ++++++++++++++++++++++ docs/source/markdown/podman-container.1.md | 2 +- docs/source/markdown/podman-diff.1.md | 32 ++++++++----- docs/source/markdown/podman-image-diff.1.md | 18 ++++++-- 5 files changed, 88 insertions(+), 19 deletions(-) delete mode 100644 docs/source/markdown/links/podman-container-diff.1 create mode 100644 docs/source/markdown/podman-container-diff.1.md (limited to 'docs') diff --git a/docs/source/markdown/links/podman-container-diff.1 b/docs/source/markdown/links/podman-container-diff.1 deleted file mode 100644 index ac4881f98..000000000 --- a/docs/source/markdown/links/podman-container-diff.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/podman-diff.1 diff --git a/docs/source/markdown/podman-container-diff.1.md b/docs/source/markdown/podman-container-diff.1.md new file mode 100644 index 000000000..89a749fbd --- /dev/null +++ b/docs/source/markdown/podman-container-diff.1.md @@ -0,0 +1,54 @@ +% podman-container-diff(1) + +## NAME +podman\-container\-diff - Inspect changes on a container's filesystem + +## SYNOPSIS +**podman container diff** [*options*] *container* [*container*] + +## DESCRIPTION +Displays changes on a container's filesystem. The container will be compared to its parent layer or the second argument when given. + +The output is prefixed with the following symbols: + +| Symbol | Description | +|--------|-------------| +| A | A file or directory was added. | +| D | A file or directory was deleted. | +| C | A file or directory was changed. | + +## OPTIONS + +#### **--format** + +Alter the output into a different format. The only valid format for **podman container diff** is `json`. + +#### **--latest**, **-l** + +Instead of providing the container name or ID, use the last created container. If you use methods other than Podman +to run containers such as CRI-O, the last started container could be from either of those methods. (This option is not available with the remote Podman client) + +## EXAMPLE + +``` +# podman container diff container1 +C /usr +C /usr/local +C /usr/local/bin +A /usr/local/bin/docker-entrypoint.sh +``` + +``` +$ podman container diff --format json container1 container2 +{ + "added": [ + "/test" + ] +} +``` + +## SEE ALSO +**[podman(1)](podman.1.md)**, **[podman-container(1)](podman-container.1.md)** + +## HISTORY +July 2021, Originally compiled by Paul Holzinger diff --git a/docs/source/markdown/podman-container.1.md b/docs/source/markdown/podman-container.1.md index e85d69c59..e69c5a170 100644 --- a/docs/source/markdown/podman-container.1.md +++ b/docs/source/markdown/podman-container.1.md @@ -19,7 +19,7 @@ The container command allows you to manage containers | commit | [podman-commit(1)](podman-commit.1.md) | Create new image based on the changed container. | | cp | [podman-cp(1)](podman-cp.1.md) | Copy files/folders between a container and the local filesystem. | | create | [podman-create(1)](podman-create.1.md) | Create a new container. | -| diff | [podman-diff(1)](podman-diff.1.md) | Inspect changes on a container or image's filesystem. | +| diff | [podman-container-diff(1)](podman-container-diff.1.md) | Inspect changes on a container's filesystem | | exec | [podman-exec(1)](podman-exec.1.md) | Execute a command in a running container. | | exists | [podman-container-exists(1)](podman-container-exists.1.md) | Check if a container exists in local storage | | export | [podman-export(1)](podman-export.1.md) | Export a container's filesystem contents as a tar archive. | diff --git a/docs/source/markdown/podman-diff.1.md b/docs/source/markdown/podman-diff.1.md index dbab2d4db..fd574abb1 100644 --- a/docs/source/markdown/podman-diff.1.md +++ b/docs/source/markdown/podman-diff.1.md @@ -4,18 +4,24 @@ podman\-diff - Inspect changes on a container or image's filesystem ## SYNOPSIS -**podman diff** [*options*] *name* - -**podman container diff** [*options*] *name* +**podman diff** [*options*] *container|image* [*container|image*] ## DESCRIPTION -Displays changes on a container or image's filesystem. The container or image will be compared to its parent layer +Displays changes on a container or image's filesystem. The container or image will be compared to its parent layer or the second argument when given. + +The output is prefixed with the following symbols: + +| Symbol | Description | +|--------|-------------| +| A | A file or directory was added. | +| D | A file or directory was deleted. | +| C | A file or directory was changed. | ## OPTIONS #### **--format** -Alter the output into a different format. The only valid format for diff is `json`. +Alter the output into a different format. The only valid format for **podman diff** is `json`. #### **--latest**, **-l** @@ -25,15 +31,12 @@ to run containers such as CRI-O, the last started container could be from either ## EXAMPLE ``` -# podman diff redis:alpine -C /usr -C /usr/local -C /usr/local/bin -A /usr/local/bin/docker-entrypoint.sh +$ podman diff container1 +A /myscript.sh ``` ``` -# podman diff --format json redis:alpine +$ podman diff --format json myimage { "changed": [ "/usr", @@ -46,8 +49,13 @@ A /usr/local/bin/docker-entrypoint.sh } ``` +``` +$ podman diff container1 image1 +A /test +``` + ## SEE ALSO -podman(1) +**[podman(1)](podman.1.md)**, **[podman-container-diff(1)](podman-container-diff.1.md)**, **[podman-image-diff(1)](podman-image-diff.1.md)** ## HISTORY August 2017, Originally compiled by Ryan Cole diff --git a/docs/source/markdown/podman-image-diff.1.md b/docs/source/markdown/podman-image-diff.1.md index 9b1dfa45a..933cd0f9a 100644 --- a/docs/source/markdown/podman-image-diff.1.md +++ b/docs/source/markdown/podman-image-diff.1.md @@ -4,21 +4,29 @@ podman-image-diff - Inspect changes on an image's filesystem ## SYNOPSIS -**podman image diff** [*options*] *name* +**podman image diff** [*options*] *image* [*image*] ## DESCRIPTION -Displays changes on a container or image's filesystem. The container or image will be compared to its parent layer +Displays changes on an image's filesystem. The image will be compared to its parent layer or the second argument when given. + +The output is prefixed with the following symbols: + +| Symbol | Description | +|--------|-------------| +| A | A file or directory was added. | +| D | A file or directory was deleted. | +| C | A file or directory was changed. | ## OPTIONS #### **--format** -Alter the output into a different format. The only valid format for diff is `json`. +Alter the output into a different format. The only valid format for **podman image diff** is `json`. ## EXAMPLE ``` -# podman diff redis:old redis:alpine +$ podman diff redis:old C /usr C /usr/local C /usr/local/bin @@ -26,7 +34,7 @@ A /usr/local/bin/docker-entrypoint.sh ``` ``` -# podman diff --format json redis:old redis:alpine +$ podman diff --format json redis:old redis:alpine { "changed": [ "/usr", -- cgit v1.2.3-54-g00ecf