996 Commits

Author SHA1 Message Date
991c90de1f Merge pull request #13314 from flouthoc/container-commit-squash
container-commit: support `--squash` to squash layers into one if users want.
2022-02-23 13:07:00 -05:00
fbbcb957c7 container-commit: support --squash to squash layers into one
Allow users to commit containers into a single layer.

Usage
```bash
podman container commit --squash <name>
```

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-23 17:38:28 +05:30
94df701512 Implement Podman Container Clone
podman container clone takes the id of an existing continer and creates a specgen from the given container's config
recreating all proper namespaces and overriding spec options like resource limits and the container name if given in the cli options

this command utilizes the common function DefineCreateFlags meaning that we can funnel as many create options as we want
into clone over time allowing the user to clone with as much or as little of the original config as they want.

container clone takes a second argument which is a new name and a third argument which is an image name to use instead of the original container's

the current supported flags are:

--destroy (remove the original container)
--name (new ctr name)
--cpus (sets cpu period and quota)
--cpuset-cpus
--cpu-period
--cpu-rt-period
--cpu-rt-runtime
--cpu-shares
--cpuset-mems
--memory
--run

resolves #10875

Signed-off-by: cdoern <cdoern@redhat.com>
Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Signed-off-by: cdoern <cdoern@redhat.com>
2022-02-20 21:11:14 -05:00
3f28d697ee Add 409 response to swagger godoc
When attempting to create a network with a name that already exists,
a 409 status code will be returned

[NO NEW TESTS NEEDED]

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-02-10 13:47:24 -07:00
c4676c5719 Add version guard to libpod API endpoints
* Ensure meaningful behaviour when called with /v3.x.x semantics
* Change return code to 409 from 500 when client attempts to use an
  existing network name
* Update API bats test runner to support /v4.0.0 endpoints by default

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-02-09 14:22:42 -07:00
eb0a0db318 Merge pull request #13142 from tmds/ImageCreate_200_schema
[CI:DOCS] Add schema for ImageCreate 200 response.
2022-02-09 04:45:13 -05:00
e405fefb31 [NO NEW TEST NEEDED] Add schema for ImageCreate 200 response.
Signed-off-by: Tom Deseyn <tom.deseyn@gmail.com>
2022-02-09 10:12:47 +01:00
3b561a4682 compat: endpoint /build must set header content type as application/json in reponse
Lot of clients are expecting proper `Content-type: application/json`
configured in response headers of `/build` compat api. Following commit
fixes that.

Fixes issues where code is setting header field after writing header
which is wrong. We must set `content-type` before we write and flush
http header.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-07 13:38:19 +05:30
956664f65b Merge pull request #12930 from cdoern/podCgroup
Podman pod create --share-parent vs --share=cgroup
2022-02-04 09:41:12 -05:00
9eb88ea474 Podman pod create --share-parent vs --share=cgroup
separated cgroupNS sharing from setting the pod as the cgroup parent,
made a new flag --share-parent which sets the pod as the cgroup parent for all
containers entering the pod

remove cgroup from the default kernel namespaces since we want the same default behavior as before which is just the cgroup parent.

resolves #12765

Signed-off-by: cdoern <cdoern@redhat.com>
Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Signed-off-by: cdoern <cdoern@redhat.com>
2022-02-03 09:30:17 -05:00
44a87229b6 Update godoc, swagger using wrong struct
Documentation for API volume list, pointed to a different struct
than the code.

[NO NEW TESTS NEEDED]

Fixes #12987

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-01-25 10:05:51 -07:00
95db13d342 Merge pull request #12969 from rhatdan/remote
Fix handling of duplicate matches on id expansion
2022-01-25 00:01:41 -05:00
dbfe79757b remote build: set rootless oci isolation correctly
When we run rootless buildah needs to have IsolationOCIRootless set
otherwise it will run code which cannot be used as rootless user.
Podman should use the buildah default if possible and change it to
rootless mode if needed.

[NO NEW TESTS NEEDED] Should be covered by existing tests once we have
podman-remote rootless tests.

Fixes #12989

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-24 19:51:59 +01:00
80a5295d42 Fix handling of duplicate matches on id expansion
Fixes: https://github.com/containers/podman/issues/12963

[NO NEW TESTS NEEDED] I don't know how to create two
containers with the same first digit of the digest,
which I could them attempt to remove.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-24 13:19:16 -05:00
7938f32c53 Remove unused param and clean API handlers
This commit removes error message string from utils.Error in pkg/api.
Param was not used inside a function for quite a long time
[NO NEW TESTS NEEDED]

Signed-off-by: Jakub Guzik <jguzik@redhat.com>
2022-01-22 00:31:18 +01:00
653da8fe8f Fix #2 for compat commit handling of --changes
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-21 07:22:36 -05:00
1c0fdba4f2 compat: remove hardcoded index from load images output report
Signed-off-by: Aditya R <arajan@redhat.com>
2022-01-21 00:46:17 +05:30
9df31cfb77 compat: images/load must be able to load tar with multiple images
`http:/host:port/images/load` fails to accept tar with more than one
images however manual load works as expected. Remove explicit check for
`1` image and only fail if result set has value less than `1`.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-01-21 00:23:54 +05:30
7fc8bf4a42 Merge pull request #12887 from esendjer/main
Add custom defined dependencies to podman generate systemd
2022-01-19 20:29:01 -05:00
c674d3cc75 Handle changes in docker compat mode
Fixes: https://github.com/containers/podman/issues/12830

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-19 13:03:58 -05:00
b9a2d8698a Handlers for generate systemd with custom dependencies
This commit includes:
* Handlers for generate systemd unit
  with manually defined dependencies such as:
  Wants=, After= and Requires=

* The new unit and e2e tests for checking generated systemd units
  for container and pod with custom dependencies

* Documented descriptions for custom dependencies options

Signed-off-by: Eugene (Evgenii) Shubin <esendjer@gmail.com>
2022-01-19 21:46:16 +05:00
4b384e08a9 Add IndexConfigs to compat /info endpoint
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-01-19 13:46:32 +01:00
bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00
8514ebd182 Merge pull request #12860 from rhatdan/cgroups
Use CONTAINERS_CONF cgroups flag for remote API.
2022-01-17 12:57:20 +01:00
3c9e41bb53 Merge pull request #12572 from rhatdan/image
Remove two GetImages functions from API
2022-01-15 20:39:16 +01:00
8a7e70919f Refactor manifest list operations
* Update method/function signatures use the manifest list name and
  images associated with the operation explicitly, in general

  func f(ctx context.Context, manifestListName string,
         ImageNames []string, options *fOptions)

* Leverage gorilla/mux Subrouters to support API v3.x and v4.x for
  manifests
* Make manifest API endpoints more RESTful
* Add PUT /manifest/{id} to update existing manifests
* Add manifests.Annotate to go bindings, uncommented unit test
* Add DELETE /manifest/{Id} to remove existing manifest list, use
  PUT /manifest/{id} to remove images from a list
* Deprecated POST /manifest/{id}/add and /manifest/{id}/remove, use
  PUT /manifest/{id} instead
* Corrected swagger godoc and updated to cover API changes
* Update podman manifest commands to use registry.Context()
* Expose utils.GetVar() to obtain query parameters by name
* Unexpose server.registerSwaggerHandlers, not sure why this was ever
  exposed.
* Refactored code to use http.Header instead of map[string]string when
  operating on HTTP headers.
* Add API-Version header support in bindings to allow calling explicate
  versions of the API. Header is _NOT_ forwarded to the API service.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-01-14 16:13:35 -07:00
a15dfb3648 Standardize on capatalized Cgroups
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 12:30:20 -05:00
14940a067d Remove two GetImages functions from API
[NO NEW TESTS NEEDED] This is just code cleanup.

The remote API has three different GetImages functions, which I believe
can be handled by just one function.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 07:37:55 -05:00
92e7875210 podman build enable --all-platforms and --unsetenv
Make sure we add support for allplatforms and unsetenv to both local and
remote podman.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-13 15:01:28 +01:00
0151e10b62 update buildah to latest and use new network stack
Make sure buildah uses the new network stack.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-12 17:40:12 +01:00
495884b319 use libnetwork from c/common
The libpod/network packages were moved to c/common so that buildah can
use it as well. To prevent duplication use it in podman as well and
remove it from here.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-12 17:07:30 +01:00
8f2358eeaa Add podman rm --depend
This option causes Podman to not only remove the specified containers
but all of the containers that depend on the specified
containers.
Fixes: https://github.com/containers/podman/issues/10360

Also ran codespell on the code

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-11 14:33:54 -05:00
19a4759066 Use the InfraImage defined in containers.conf
Remove hard code use of the DefaultInfraImage and rely on
getting this from containers.conf.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-10 16:13:33 -05:00
2fd6c2ee89 Merge pull request #11538 from mtrmac/http-credentials
Fix HTTP credentials passing
2022-01-06 16:50:12 +01:00
6809237436 correct typo words in docs
"for creating a container" appears for networks and volumes

Signed-off-by: David Marshall <dmarshall@gmail.com>
2022-01-05 15:23:07 -08:00
50e156b605 Merge pull request #12208 from cdoern/podSecurityOpt
Pod Security Option support and Infra Inheritance changes
2022-01-05 17:56:36 +01:00
ec9d67b7e4 Merge pull request #12735 from rhatdan/mount
Fix Container List API call to return mount info
2022-01-04 19:52:05 +01:00
9a35494141 Merge pull request #12643 from leahneukirchen/events-compat
legacy events: also set Action="die"
2022-01-04 19:50:09 +01:00
0c6ae3ab26 Fix Container List API call to return mount info
We are hard coding mounts to return nil in compat API,
since we have the data, we should return it.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-04 10:56:03 -05:00
116a276e8c legacy events: also set exitCode
For Status = "die", Docker sets the exit code of the container
to a field "exitCode".  Podman uses "containerExitCode".
Copy the value into "exitCode" as well, for compatibility.

Signed-off-by: Leah Neukirchen <leah@vuxu.org>
2022-01-03 14:00:13 +01:00
1e3434d114 Update swagger documentation
[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-31 08:43:56 -05:00
a2687783d4 prefix imageId with sha256: in containers list
test for compat API ImageId

Signed-off-by: Oliver Thallmair <oliver.thallmair@mailbox.org>
2021-12-29 00:26:12 +01:00
289270375a Pod Security Option support
Added support for pod security options. These are applied to infra and passed down to the
containers as added (unless overridden).

Modified the inheritance process from infra, creating a new function Inherit() which reads the config, and marshals the compatible options into an intermediate struct `InfraInherit`
This is then unmarshaled into a container config and all of this is added to the CtrCreateOptions. Removes the need (mostly) for special additons which complicate the Container_create
code and pod creation.

resolves #12173

Signed-off-by: cdoern <cdoern@redhat.com>
2021-12-27 13:39:36 -05:00
a5e49d9668 Warn on use of --kernel-memory
It has been deprecated and is no longer supported.  Fully remove it and
only print a warning if a user uses it.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2011695

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-22 06:20:21 -05:00
85f21fb2bd Merge pull request #12664 from cdoern/noManagePasswd
Podman run --passwd
2021-12-22 12:09:56 +01:00
20ce6e5c60 Podman run --passwd
added support for a new flag --passwd which, when false prohibits podman from creating entries in
/etc/passwd and /etc/groups allowing users to modify those files in the container entrypoint

resolves #11805

Signed-off-by: cdoern <cdoern@redhat.com>
2021-12-21 17:19:41 -05:00
b1f5e861b0 compat: image normalization: handle sha256 prefix
When normalizing image names on the compat API, make sure to take the
`sha256:` prefix into account when matching against the image ID.
Otherwise, the name will mistakingly be subject to docker.io
normalization.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-20 17:27:02 +01:00
a1ebde118a legacy events: also set Action="die"
Since #10168, on the event "died", the Status is set to "die"
for compatibility with the Docker API.  Docker also sets
the field Action to "died", so do the same here.

Signed-off-by: Leah Neukirchen <leah@vuxu.org>
2021-12-17 15:24:48 +01:00
7dabcbd7bc Merge pull request #12534 from Luap99/network-db
network db rewrite
2021-12-15 15:25:14 +01:00
52b12fe985 Fixes #12063 Add docker compatible output after image build.
Signed-off-by: Ananth Bhaskararaman <antsub@gmail.com>
2021-12-14 21:08:31 +05:30