10713 Commits

Author SHA1 Message Date
99c5746150 Merge pull request #8958 from zhangguanzhang/duplicated-hosts
Fixes /etc/hosts duplicated every time after container restarted in a pod
2021-01-13 09:58:09 -05:00
183f443a58 Merge pull request #8957 from srcshelton/feature/issue-8945
Add 'MemUsageBytes' format option
2021-01-13 06:28:00 -05:00
0a7f4eaa9d play kube: set entrypoint when interpreting Command
We now set Entrypoint when interpeting the image Entrypoint (or yaml.Command)
and Command when interpreting image Cmd (or yaml.Args)

This change is kind of breaking because now checking Config.Cmd won't return
the full command, but only the {cmd,args}.

Adapt the tests to this change as well

Signed-off-by: Peter Hunt <pehunt@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-13 06:10:50 -05:00
85460bc41c Merge pull request #8877 from rhatdan/load
Remove the ability to use [name:tag] in podman load command
2021-01-13 06:03:51 -05:00
0cff5ad0a3 Fxes /etc/hosts duplicated every time after container restarted in a pod
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2021-01-13 19:03:35 +08:00
a2367705be Merge branch 'master' into feature/issue-8945
Signed-off-by: Stuart Shelton <stuart@shelton.me>
2021-01-13 00:56:05 +00:00
a6af56f5b4 Add 'MemUsageBytes' format option
Although storage is more human-readable when expressed in SI units,
IEC/JEDEC (Bytes) units are more pertinent for memory-related values
(and match the format of the --memory* command-line options).

(To prevent possible compatibility issues, the default SI display is
left unchanged)

See https://github.com/containers/podman/issues/8945

Signed-off-by: Stuart Shelton <stuart@shelton.me>
2021-01-12 23:38:08 +00:00
f52a9eeeea Merge pull request #8953 from edsantiago/var_run_again
More /var/run -> /run
2021-01-12 18:36:33 -05:00
a6046dceef Remove the ability to use [name:tag] in podman load command
Docker does not support this, and it is confusing what to do if
the image has more then one tag.  We are dropping support for this
in podman 3.0

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-12 17:38:32 -05:00
3ff8f27651 More /var/run -> /run
PR #8851 broke CI: it included "/var/run" strings that,
per #8771, should have been just "/run".

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-01-12 17:38:32 -05:00
68ca9066d0 More /var/run -> /run
PR #8851 broke CI: it included "/var/run" strings that,
per #8771, should have been just "/run".

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-01-12 12:38:11 -07:00
265ec914d3 Merge pull request #8950 from mheon/exorcise_driver
Exorcise Driver code from libpod/define
2021-01-12 14:02:32 -05:00
db52828621 Merge pull request #8946 from JAORMX/sec-errors
Expose security attribute errors with their own messages
2021-01-12 13:46:29 -05:00
b5c8cee932 Merge pull request #8900 from cevich/no_tag_testing
Cirrus: Skip most tests on tag-push
2021-01-12 13:38:59 -05:00
db5e7ec4c4 Merge pull request #8947 from Luap99/cleanup-code
Fix problems reported by staticcheck
2021-01-12 13:15:35 -05:00
befd40b57d Exorcise Driver code from libpod/define
The libpod/define code should not import any large dependencies,
as it is intended to be structures and definitions only. It
included the libpod/driver package for information on the storage
driver, though, which brought in all of c/storage. Split the
driver package so that define has the struct, and thus does not
need to import Driver. And simplify the driver code while we're
at it.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-01-12 11:48:53 -05:00
0ccc88813e Merge pull request #8851 from Luap99/fix-generate-systemd-flag-parsing
Make podman generate systemd --new flag parsing more robust
2021-01-12 11:47:14 -05:00
0532fdac1a Merge pull request #8923 from Afourcat/master
Adding json formatting to `--list-tags` option in `podman search` command.
2021-01-12 10:29:21 -05:00
8452b768ec Fix problems reported by staticcheck
`staticcheck` is a golang code analysis tool. https://staticcheck.io/

This commit fixes a lot of problems found in our code. Common problems are:
- unnecessary use of fmt.Sprintf
- duplicated imports with different names
- unnecessary check that a key exists before a delete call

There are still a lot of reported problems in the test files but I have
not looked at those.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-12 16:11:09 +01:00
020abbfeab Expose security attribute errors with their own messages
This creates error objects for runtime errors that might come from the
runtime. Thus, indicating to users that the place to debug should be in
the security attributes of the container.

When creating a container with a SELinux label that doesn't exist, we
get a fairly cryptic error message:

```
$ podman run --security-opt label=type:my_container.process -it fedora bash
Error: OCI runtime error: write file `/proc/thread-self/attr/exec`: Invalid argument
```

This instead handles any errors coming from LSM's `/proc` API and
enhances the error message with a relevant indicator that it's related
to the container's security attributes.

A sample run looks as follows:

```
$ bin/podman run --security-opt label=type:my_container.process -it fedora bash
Error: `/proc/thread-self/attr/exec`: OCI runtime error: unable to assign security attribute
```

With `debug` log level enabled it would be:

```
Error: write file `/proc/thread-self/attr/exec`: Invalid argument: OCI runtime error: unable to assign security attribute
```

Note that these errors wrap ErrOCIRuntime, so it's still possible to to
compare these errors with `errors.Is/errors.As`.

One advantage of this approach is that we could start handling these
errors in a more efficient manner in the future.

e.g. If a SELinux label doesn't exist (yet), we could retry until it
becomes available.

Signed-off-by: Juan Antonio Osorio Robles <jaosorior@redhat.com>
2021-01-12 16:10:17 +02:00
64b86d004e Merge pull request #8905 from rhatdan/proxy
Use HTTPProxy settings from containers.conf
2021-01-12 08:40:44 -05:00
5575c7be20 Merge pull request #8819 from chen-zhuohan/add-pre-checkpoint
Add pre-checkpoint and restore with previous
2021-01-12 07:57:05 -05:00
1955eee89f Merge pull request #8933 from giuseppe/use-O_PATH-for-unix-sock
oci: use /proc/self/fd/FD to open unix socket
2021-01-12 07:26:37 -05:00
fdbc278868 oci: use /proc/self/fd/FD to open unix socket
instead of opening directly the UNIX socket path, grab a reference to
it through a O_PATH file descriptor and use the fixed size string
"/proc/self/fd/%d" to open the UNIX socket.  In this way it won't hit
the 108 chars length limit.

Closes: https://github.com/containers/podman/issues/8798

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-12 10:38:32 +01:00
1c1e670d40 Use HTTPProxy settings from containers.conf
This PR takes the settings from containers.conf and uses
them.  This works on the podman local but does not fix the
issue for podman remote or for APIv2.  We need a way
to specify optionalbooleans when creating containers.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-11 17:35:39 -05:00
5681907314 Merge pull request #8939 from cevich/more_cross_builds
Cirrus: Add cross-compile test for alternative arches
2021-01-11 17:20:37 -05:00
a651089263 Merge pull request #8934 from vrothberg/fix-8931
image list: ignore bare manifest list
2021-01-11 17:13:53 -05:00
63d8f535ec Merge pull request #8917 from mheon/actually_report_play_kube_errors
Ensure that `podman play kube` actually reports errors
2021-01-11 17:06:49 -05:00
20217f5789 Merge pull request #8932 from containers/dependabot/go_modules/github.com/containers/storage-1.24.5
Bump github.com/containers/storage from 1.24.4 to 1.24.5
2021-01-11 16:57:50 -05:00
1d8b9e944f Cirrus: Add cross-compile test for alternative arches
Followup to https://github.com/containers/podman/pull/8907 that simply
ensures cross-compiling podman completes.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-01-11 13:46:37 -05:00
1d7e5227f8 image list: ignore bare manifest list
Handle empty/bare manifest lists when listing images.

Fixes: #8931
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-11 19:15:33 +01:00
d2503ae99b Merge pull request #8935 from giuseppe/conmon-keep-LC_
oci: keep LC_ env variables to conmon
2021-01-11 09:49:34 -05:00
7e3fb33be8 Ensure that podman play kube actually reports errors
In 2.2.x, we moved `play kube` to use the Start() API for pods,
which reported errors in a different way (all containers are
started in parallel, and then results reported as a block). The
migration attempted to preserve compatibility by returning only
one error, but that's not really a viable option as it can
obscure the real reason that a pod is failing. Further, the code
was not correctly handling the API's errors - Pod Start() will,
on any container error, return a map of container ID to error
populated for all container errors *and* return ErrPodPartialFail
for overall error - the existing code did not handle the partial
failure error and thus would never return container errors.

Refactor the `play kube` API to include a set of errors for
containers in each pod, so we can return all errors that occurred
to the frontend and print them for the user, and correct the
backend code so container errors are actually forwarded.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-01-11 09:30:35 -05:00
3b987a7e4e Merge pull request #8925 from rhatdan/build
podman build --force-rm defaults to true in code
2021-01-11 08:56:03 -05:00
63ecd1215a Bump github.com/containers/storage from 1.24.4 to 1.24.5
Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.24.4 to 1.24.5.
- [Release notes](https://github.com/containers/storage/releases)
- [Changelog](https://github.com/containers/storage/blob/master/docs/containers-storage-changes.md)
- [Commits](https://github.com/containers/storage/compare/v1.24.4...v1.24.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-11 08:50:59 -05:00
ae9dab9445 oci: keep LC_ env variables to conmon
it is necessary for conmon to deal with the correct locale, otherwise
it uses C as a fallback.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1893567
Requires: https://github.com/containers/conmon/pull/215

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-11 13:48:04 +01:00
95462e802a Better test and idomatic code.
Adding another check in the `podman search --list-tags --format json` test case.
Replacing an anonymous struct by \`listEntryTag\` struct.

Signed-off-by: Alexandre Fourcat <afourcat@gmail.com>
2021-01-11 19:14:18 +09:00
41613bdb96 Merge pull request #8915 from rhatdan/remote
Improve error message when the the podman service is not enabled
2021-01-10 11:49:46 -05:00
2aa381f2d0 add pre checkpoint
Signed-off-by: Zhuohan Chen <chen_zhuohan@163.com>
2021-01-10 21:38:28 +08:00
3d453f9d2e podman build --force-rm defaults to true in code
The man page and code should match for what is the default settings.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-10 05:52:33 -05:00
bc0fa658f7 Merge pull request #8920 from Luap99/ps-network-filter
podman ps/pod ps add network filter and .Networks format placeholder
2021-01-10 05:31:11 -05:00
e1302a3023 Adding json formatting to --list-tags option in podman search
command.

Data is formatted following this JSON structure:
```json
{
    "Name": "...",
    "Tags": ["...", "...", "..."]
}
```

Closes: #8740.

Signed-off-by: Alexandre Fourcat <afourcat@gmail.com>
2021-01-10 19:04:23 +09:00
82bce7d906 Use abi PodPs implementation for libpod/pods/json endpoint
This removes unnecessary code duplication.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-09 23:38:26 +01:00
38baf3d5e2 Add Networks format placeholder to podman ps and pod ps
`podman ps --format {{.Networks}}` will show all connected networks for
this container. For `pod ps` it will show the infra container networks.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-09 19:15:43 +01:00
1242e7b7a6 Add network filter for podman ps and pod ps
Allow to filter on the network name or full id.
For pod ps it will filter on the infra container networks.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-09 17:03:32 +01:00
ea68f178e0 Improve error message when the the podman service is not enabled
Currently if server is not connected, we return an error message that
is confusing users on Mac and Windows boxes.  The hope here is to make
it a little easier to discover that a Podman service is required.

This message is similar to what Docker puts out so people might under
stand it better.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-09 04:19:39 -05:00
49db79e735 Merge pull request #8781 from rst0git/cr-volumes
Add support for checkpoint/restore of containers with volumes
2021-01-08 10:41:05 -05:00
a0b432d29d Merge pull request #8912 from jwhonce/issues/8891
Restore compatible API for prune endpoints
2021-01-08 06:56:15 -05:00
b059e1044f Restore compatible API for prune endpoints
* Restore correct API endpoint payloads including reclaimed space numbers
* Include tests for API prune endpoints
* Clean up function signatures with unused parameters
* Update swagger for /networks/prune

Fixes #8891

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-01-07 15:32:32 -07:00
78cda71372 Merge pull request #8907 from Luap99/fix-mips-build
Fix build for mips architecture follow-up
2021-01-07 15:12:35 -05:00