Commit Graph

574 Commits

Author SHA1 Message Date
Daniel J Walsh edaf3b4d5e
Add sha256: to images history id for docker compatibility
Fixes: https://github.com/containers/podman/issues/17762

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-04-26 14:38:07 -04:00
openshift-ci[bot] 1821f97ade
Merge pull request #18284 from vrothberg/fix-18216
support `--digestfile` for remote push
2023-04-21 10:24:15 +00:00
Valentin Rothberg 1f1525f2e1 support `--digestfile` for remote push
Wire in support for writing the digest of the pushed image to a
user-specified file.  Requires some massaging of _internal_ APIs
and the extension of the push endpoint to integrate the raw manifest
(i.e., in bytes) in the stream.

Closes: #18216
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-04-21 10:28:40 +02:00
Andreas Kohn b65ab52d8d compat: Translate `noprune` into ImageRemoveOptions.NoPrune
PR #15093 implemented support for NoPrune in the ImageRemoveOptions,
this PR simply brings that also to the compat API along with
regression tests.

Signed-off-by: Andreas Kohn <andreas.kohn@gmail.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-04-20 11:11:19 +02:00
Jakob Ahrer a0204f1dd0
Add missing security options to /info response
Signed-off-by: Jakob Ahrer <jakob@ahrer.dev>
2023-04-16 18:27:16 +02:00
Daniel J Walsh 1fa4e45a95
Return title fields as a list
Podman is attempting to split the headers returned by the ps
command into a list of headers. Problem is that some headers
are multi-word, and headers are not guaranteed to be split via
a tab. This PR splits the headers bases on white space, and for
the select group of CAPS headers which are multi-word, combines
them back together.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-04-13 11:45:40 -04:00
Valentin Rothberg 1f3ae8a4fb system service: do not close Body
The standard lib states that server handlers don't need to close the
body, so let's not do that to avoid any unforeseen side effect.

[NO TESTS NEEDED] - existing tests should suffice.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-04-04 15:47:10 +02:00
OpenShift Merge Robot c8eeab21cf
Merge pull request #16315 from flouthoc/remote-ignore-symlink
remote,build: ignore if `.containerignore` or `.dockerignore` is a symlink outside of buildContext
2023-03-28 23:23:07 +02:00
Paul Holzinger 5185e7e39e
stats compat API: return "id" lowercase
We use the same endpoint for libpod and docker compat API. However as
reported docker returns "id" lowercase. Because we cannot break the
libpod API right now keep the output for the libpod endpoint and only
change the docker one.

To do so simply use two types that we can cast with different JSON tags.

Fixes #17869

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-03-22 14:36:35 +01:00
OpenShift Merge Robot 9ddd4f4abd
Merge pull request #17600 from sstosh/search-auth-opts
Add search --cert-dir, --creds
2023-03-20 04:00:04 -04:00
Toshiki Sonoda 82f2f8258c Add search --cert-dir, --creds
When we searching any image at a container registry,
--cert-dir and --creds could be required
as well as push, pull, etc.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-03-15 15:01:26 +09:00
Valentin Rothberg bad41f67e7 compat: /auth: parse server address correctly
Use `auth.Login` as `podman login` does which parses and normalizes the
input addresses correctly, especially for docker.io.

[NO NEW TESTS NEEDED] as we do not have means to test logging into
docker.io in CI.

Fixes: #17571
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-03-13 13:41:49 +01:00
Paul Holzinger 4b4b423b6c
compat API: network create return 409 for duplicate
If the name already exists and CheckDuplicate is set we need to return
409, if CheckDuplicate is not set we return the network without error.

Fixes #17585

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-02-21 16:55:27 +01:00
Erik Sjölund 08e13867a9 Fix typos. Improve language.
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-02-09 21:56:27 +01:00
Miloslav Trmač e308ba0215 Vendor c/image after https://github.com/containers/image/pull/1816
Also includes unreleased https://github.com/openshift/imagebuilder/pull/246 to work
with the updated docker/docker dependency.

And updates some references to newly deprecated docker/docker symbols.

[NO NEW TESTS NEEDED]

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-02-08 22:37:38 +01:00
Valentin Rothberg ced9342840 network ls: handle removed container
Handle a race condition in the REST API when listing networks.
In between listing all containers and inspecting them, they may have
already been removed, so handle this case gracefully.

[NO NEW TESTS NEEDED] as it's a race condition.

Fixes: #17341
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-07 09:49:50 +01:00
Erik Sjölund 83a0e97ab8 Add missing return after errors
Add missing return after utils.Error(),
utils.InternalServerError(), utils.BadRequest().

[NO NEW TESTS NEEDED]

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-02-06 20:32:06 +01:00
OpenShift Merge Robot 45bb8dbdf7
Merge pull request #17114 from rhatdan/devices
Allow --device-cgroup-rule to be passed in by docker API
2023-01-26 14:32:19 -05:00
Aditya R 70e8f6243a
remote,build: error if containerignore is symlink
Drop support for remote use-cases when `.containerignore` or
`.dockerignore` is a symlink pointing to arbitrary location on host.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-01-26 16:11:51 +05:30
Valentin Rothberg c74bdae351 DB: make loading container states optional
Loading container states speed things up when listing all containers but
it comes with a price tag for many other call paths.  Hence, make
loading the state conditional to allow for keeping `podman ps` fast
without other commands regressing in performance.

[NO NEW TESTS NEEDED]

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-26 10:20:38 +01:00
Daniel J Walsh 8f78865151
Add support for podman build --group-add
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-19 10:42:10 -05:00
Daniel J Walsh 8850db961d
Allow --device-cgroup-rule to be passed in by docker API
This looks like the correct fix, but I have no idea how to test.

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

[NO NEW TESTS NEEDED]

Will have reporter verify if this fixes the problem.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-13 17:02:45 -05:00
Romain Geissler 3e2b9a28da [docker compat] Don't overwrite the NetworkMode if containers.conf overrides netns.
Fixes #16915 (only the part about docker client).

Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
2023-01-11 17:44:09 +00:00
Daniel J Walsh 338b283935
Add containers.conf read-only flag support
If you are running temporary containers within podman play kube
we should really be running these in read-only mode. For automotive
they plan on running all of their containers in read-only temporal
mode. Adding this option guarantees that the container image is not
being modified during the running of the container.

The containers can only write to tmpfs mounted directories.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-22 11:57:28 -05:00
OpenShift Merge Robot 5f4d7b575d
Merge pull request #16888 from Luap99/export-fd
export: use io.Writer instead of file
2022-12-20 10:47:19 -05:00
Paul Holzinger 3ac5d10098
export: use io.Writer instead of file
This allows use to use STDOUT directly without having to call open
again, also this makes the export API endpoint much more performant
since it no longer needs to copy to a temp file.
I noticed that there was no export API test so I added one.

And lastly opening /dev/stdout will not work on windows.

Fixes #16870

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-20 14:38:41 +01:00
Aditya R 987c8e3a78
vendor: bump to buildah ca578b290144 and use new cache API
Bump to buildah ca578b290144 and use new `cacheTo` and `cacheFrom` API.

[NO NEW TESTS NEEDED]
[NO TESTS NEEDED]

Signed-off-by: Aditya R <arajan@redhat.com>
2022-12-20 17:13:59 +05:30
OpenShift Merge Robot 536d3b87f0
Merge pull request #16818 from SoMuchForSubtlety/api-port-bindings
api: remove unmapped ports from PortBindings
2022-12-15 20:19:53 -05:00
Jakob Ahrer 97f63da67d
remove unmapped ports from inspect port bindings
Signed-off-by: Jakob Ahrer <jakob@ahrer.dev>
2022-12-15 23:18:50 +01:00
OpenShift Merge Robot 1cc22631f6
Merge pull request #16773 from ygalblum/network_ignore
Network Create: Add --ignore flag to support idempotent script
2022-12-15 14:27:25 -05:00
Ygal Blum bddd3f5b5f Network Create: Add --ignore flag to support idempotent script
Add --ignore flag to the command line
Add a new parameter to the NetworkCreate interface in pkg/domain for CreateOptions
Add a new API Network CreateWithOptions in pkg/bindings
Remote API - Add a query parameter to set the ignore flag
Kube - use the IgnoreIfExists flag when creating the default network instead of handling the failure
Add e2e tests
Update man page for podman-network-create

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-12-15 10:58:54 +02:00
Paul Holzinger 9f6cf50d52
podman-remote build add --volume support
Just like podman-remote run users should still be able to set volumes,
of course the source must be on the server machine but this is already
the case for podman machine for example.

Fixes #16694

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-08 17:10:46 +01:00
Paul Holzinger 2f5025a2d7
compat API: allow MacAddress on container config
docker-compose sets the mac address in the container config and not the
network endpoint config. This is ugly when you have more than one
network, in this case docker just chooses the first network.

Fixes #16411

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-05 16:52:36 +01:00
Daniel J Walsh f17479c711
Run codespell on code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-28 15:13:43 -05:00
Aditya R c7073b5fc5
compat,build: handle docker's preconfigured cacheTo,cacheFrom
Docker's newer clients popuates `cacheFrom` and `cacheTo` parameter
by default as empty array for all commands but buildah's design of
distributed cache expects this to be a repo not image hence parse
only the first populated repo and igore if empty array.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-11-14 22:08:09 +05:30
Stefano Brivio aa47e05ae4 libpod: Add pasta networking mode
Conceptually equivalent to networking by means of slirp4netns(1),
with a few practical differences:

- pasta(1) forks to background once networking is configured in the
  namespace and quits on its own once the namespace is deleted:
  file descriptor synchronisation and PID tracking are not needed

- port forwarding is configured via command line options at start-up,
  instead of an API socket: this is taken care of right away as we're
  about to start pasta

- there's no need for further selection of port forwarding modes:
  pasta behaves similarly to containers-rootlessport for local binds
  (splice() instead of read()/write() pairs, without L2-L4
  translation), and keeps the original source address for non-local
  connections like slirp4netns does

- IPv6 is not an experimental feature, and enabled by default. IPv6
  port forwarding is supported

- by default, addresses and routes are copied from the host, that is,
  container users will see the same IP address and routes as if they
  were in the init namespace context. The interface name is also
  sourced from the host upstream interface with the first default
  route in the routing table. This is also configurable as documented

- sandboxing and seccomp(2) policies cannot be disabled

- only rootless mode is supported.

See https://passt.top for more details about pasta.

Also add a link to the maintained build of pasta(1) manual as valid
in the man page cross-reference checks: that's where the man page
for the latest build actually is -- it's not on Github and it doesn't
match any existing pattern, so add it explicitly.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2022-11-08 00:16:35 +01:00
Jake Torrance cdb00332da Docker compat build api - make sure only one line appears per flush
Closes #16360

Signed-off-by: Jake Torrance <jake.torrance@oracle.com>
Signed-off-by: Jake Torrance <jaket1234@hotmail.com>
2022-11-06 09:43:34 +00:00
Alexander Larsson 55191ecc20 Add and use Container.LinuxResource() helper
This gets c.config.Spec.Linux.Resources, with some nil checks.
Using this means less open coding of the nil-checks, but also the
existing user of this field in moveConmonToCgroupAndSignal() was
using ctr.Spec().Linux.Resources instead, and the Spec() call
is very expensive.

[NO NEW TESTS NEEDED] Just minor performance effects

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-12 13:45:49 +02:00
Brent Baude aaa9f4ea90 Prevent nil pointer deref in GetImage
Trying to print the image id on a failed inspect will result in a nil
pointer panic because the image will be nil.  Replace image.id with the
image name which is defined as a string without the use of inspect.

Fixes: bz#2131836

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-10-04 15:31:00 -05:00
Paul Holzinger 52656887e1
compat API: network inspect do not show isolate option
We force the isolate option on new newtworks because that is the docker
behavior. However when we inspect them they should not be displayed to
the caller since they have no idea about it and docker-compose throws an
error because of that.

Fixes #15580

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-25 22:10:22 -04:00
Ed Santiago f5e83f6849
Fixup Buildah merge
Changes since 2022-09-09:
 - man page: add --skip-unused-stages (buildah 4249)
 - man page: bring in new Note for --cache-ttl (4248)
 - system tests: de-stutter (4205)

 - (internal): in skip() applier: escape asterisk, otherwise
   the "bud with --dns* flags" sed expression never applies.

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-09-23 14:13:12 -04:00
OpenShift Merge Robot 12655484e3
Merge pull request #15871 from cevich/replace_ioutil
Replace deprecated ioutil
2022-09-21 16:12:25 +02:00
OpenShift Merge Robot ffa73c58a5
Merge pull request #15842 from ashley-cui/seclabels
Add labels to secrets
2022-09-21 13:15:28 +02:00
Ashley Cui 9bb51e8e96 Add labels to secrets
Add --label/-l label flag to secret create, and show labels when
inspecting secrets. Also allow labeling secrets via libpod/compat API.

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-09-20 16:28:00 -04:00
Chris Evich d968f3fe09
Replace deprecated ioutil
Package `io/ioutil` was deprecated in golang 1.16, preventing podman from
building under Fedora 37.  Fortunately, functionality identical
replacements are provided by the packages `io` and `os`.  Replace all
usage of all `io/ioutil` symbols with appropriate substitutions
according to the golang docs.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-09-20 15:34:27 -04:00
Giuseppe Scrivano 60ef4ad1c8
stats: cap memory limit to the available memory
Docker compatibility: cap the memory limit reported by the cgroup to
the maximum available memory.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-09-15 09:00:03 +02:00
Giuseppe Scrivano cf2118eab3
stats: map MaxUsage to the correct value
and make sure it is not set for cgroup v2

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-09-15 00:51:56 +02:00
OpenShift Merge Robot d88d74639f
Merge pull request #15753 from mheon/fix_15720
Ensure that the DF endpoint updated volume refcount
2022-09-13 13:35:10 +02:00
Matthew Heon 07a8eb8295 Ensure that the DF endpoint updated volume refcount
The field was already exposed already in the `system df` output
so this just required a bit of plumbing and testing.

As part of this, fix `podman systemd df` volume in-use logic.
Previously, volumes were only considered to be in use if the
container using them was running. This does not match Docker's
behavior, where a volume is considered in use as long as a
container exists that uses the volume, even if said container is
not running.

Fixes #15720

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2022-09-12 16:43:24 -04:00
OpenShift Merge Robot 5abc08df25
Merge pull request #15511 from rhatdan/codespell
Fix stutters
2022-09-12 16:52:08 +02:00