Commit Graph

709 Commits

Author SHA1 Message Date
Milivoje Legenovic 9fc29f63e0 Correct compat images/{name}/push response
Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
2021-03-07 02:38:01 +01:00
Daniel J Walsh d107c37296
podman-remote stop -time 0 does not work
This patch will allow users to pass in the time 0.
Currently the timeout will take 10 seconds if user passes
in the 0 flag.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-05 10:39:17 -05:00
OpenShift Merge Robot 7a92de4bac
Merge pull request #9550 from baude/issue9517
Support label type dict on compat build
2021-03-04 11:09:25 -05:00
Jhon Honce f86d641308 Use version package to track all versions
* Server, bindings, and CLI all now pull version information from version
package.
* Current /libpod API version slaved to podman/libpod Version
* Bindings validate against libpod API Minimal version
* Remove pkg/bindings/bindings.go and updated tests

Fixes: #9207

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-03-03 17:03:19 -07:00
OpenShift Merge Robot 8a1955f419
Merge pull request #9581 from baude/issue9529
Add network summary to compat ps
2021-03-03 11:13:22 -05:00
OpenShift Merge Robot 259bb5f723
Merge pull request #9583 from ashley-cui/sec
Add version field to secret compat list/inspect api
2021-03-03 09:17:21 -05:00
baude 8f2192922d Add network summary to compat ps
The compatibility endpoint for listing containers should have the
summarized network configuration with it.

Fixes: #9529

Signed-off-by: baude <bbaude@redhat.com>
2021-03-03 08:16:58 -06:00
Ashley Cui 9391bfc520 Add version field to secret compat list/inspect api
Docker api expects secrets endpoint to have a version field. So, the
version field is added into the compat endpoint only. The version field
is always 1, since Docker uses the version to keep track of updates to
the secret, and currently we cannot update a secret.

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-03-02 16:55:21 -05:00
Daniel J Walsh 5df6251402
Fix support for podman build --timestamp
Currently podman is ignoreing the build --timestamp flag.
This PR fixes this for local and remote clients.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-02 14:25:29 -05:00
baude 2c8c5393a4 Support label type dict on compat build
The compatibility endpoint for build labels should be of type dict (not
list).  For backwards compatibility, we support both.

Fixes: #9517

Signed-off-by: baude <bbaude@redhat.com>
2021-03-02 10:56:28 -06:00
Milivoje Legenovic 8b7caa6d04 Compat api containers/json Ports field is null
Fixes #9553

Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
2021-03-02 02:50:41 +01:00
OpenShift Merge Robot b5827d80d3
Merge pull request #9531 from Luap99/fix-9526
compat api network ls accept both format options
2021-03-01 16:28:51 +01:00
OpenShift Merge Robot b154c519ac
Merge pull request #9509 from mlegenovic/master
Correct compat images/create?fromImage response
2021-03-01 08:27:47 +01:00
Paul Holzinger f54ed7269a compat api network ls accept both format options
Docker allows both the old `map[string]map[string]bool`
and the newer `map[string][]string` for the filter param
so we should too.

Fixes #9526

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-26 19:42:34 +01:00
Milivoje Legenovic fcce1da1bb Correct compat images/create?fromImage response
Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
2021-02-26 03:08:10 +01:00
Riyad Preukschas ba319e3ba6 [Compat API] Also print successfully tagging images in /build endpoint
[NO TESTS NEEDED]

Signed-off-by: Riyad Preukschas <riyad@informatik.uni-bremen.de>
2021-02-25 21:06:18 +01:00
baude 24d9bda7ff prune remotecommand dependency
prune a dependency that was only being used for a simple struct.  Should
correct checksum issue on tarballs

[NO TESTS NEEDED]

Fixes: #9355

Signed-off-by: baude <bbaude@redhat.com>
2021-02-25 10:02:41 -06:00
OpenShift Merge Robot 96fc9d983e
Merge pull request #9480 from jmguzik/replace-nil-with-braces-network-resource
[NO TESTS NEEDED] Replace Labels and Options nulls with {} in NetworkResource
2021-02-22 20:41:39 -05:00
Jakub Guzik fcf669fd98 Replace Labels and Options nulls with {} in NetworkResource
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-02-23 00:31:17 +01:00
OpenShift Merge Robot a6e7d19c46
Merge pull request #9445 from jmguzik/no-header-info-for-systemd-generation
No header info for systemd generation
2021-02-22 13:44:43 -05:00
Jakub Guzik d2f3098c6f --no-header flag implementation for generate systemd
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-02-22 14:48:33 +01:00
OpenShift Merge Robot 10d52c05e2
Merge pull request #9275 from rhatdan/build
Add missing params for podman-remote build
2021-02-22 06:29:32 -05:00
Valentin Rothberg 5dded6fae7 bump go module to v3
We missed bumping the go module, so let's do it now :)

* Automated go code with github.com/sirkon/go-imports-rename
* Manually via `vgrep podman/v2` the rest

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-02-22 09:03:51 +01:00
Nikolay Edigaryev 9699e81a06 API: fix libpod's container wait endpoint condition conversion
Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com>
2021-02-18 00:34:23 +03:00
Riyad Preukschas 68a8d397ce Add missing early returns in compat API
[NO TESTS NEEDED]

Signed-off-by: Riyad Preukschas <riyad@informatik.uni-bremen.de>
2021-02-16 23:40:09 +01:00
Valentin Rothberg 2a21ecafa7 images/create: always pull image
The `images/create` endpoint should always attempt to pull a newer
image.  Previously, the local images was used which is not compatible
with Docker and caused issues in the Gitlab CI.

Fixes: #9232
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-02-16 13:32:31 +01:00
Daniel J Walsh 690c02f602
Add missing params for podman-remote build
Fixes: https://github.com/containers/podman/issues/9290

Currently we still have hard coded --isolation=chroot for podman-remote build.

Implement missing arguments for podman build

Implements
--jobs, --disable-compression, --excludes

Fixes:
MaxPullPushRetries
RetryDuration

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-16 06:48:35 -05:00
Nikolay Edigaryev 2c31f38399 Fix superfluous response.WriteHeader call in WaitContainerLibpod()
When the query decoding fails at the beginning of WaitContainerLibpod(),
the Error() sets the header but doesn't returns after that.

This causes the execution flow to reach the WriteResponse() at the end
of WaitContainerLibpod(), which attempts to set another header, thus
causing the following error:

http: superfluous response.WriteHeader call from github.com/containers/podman/pkg/api/handlers/utils.WriteResponse (handler.go:124)

[NO TESTS NEEDED]

Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com>
2021-02-12 23:55:12 +03:00
OpenShift Merge Robot 64255f5fb8
Merge pull request #9311 from deadNightTiger/fix-pull-dockerjava
apiv2: handle docker-java clients pulling
2021-02-12 12:52:58 -05:00
Paul Holzinger 78c8a87362 Enable whitespace linter
Use the whitespace linter and fix the reported problems.

[NO TESTS NEEDED]

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-11 23:01:56 +01:00
Paul Holzinger 69ab67bf90 Enable golint linter
Use the golint linter and fix the reported problems.

[NO TESTS NEEDED]

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-11 23:01:49 +01:00
Paul Holzinger ef2fc90f2d Enable stylecheck linter
Use the stylecheck linter and fix the reported problems.

[NO TESTS NEEDED]

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-11 23:01:29 +01:00
baude f28b08fe96 Correct compat network prune response
Correcting the structure of the compat network prune response.  They
should follow {"NetworksDeleted": [<network_name>",...]}

Fixes: #9310

Signed-off-by: baude <bbaude@redhat.com>
2021-02-10 15:48:14 -06:00
Igor Korolev fdf39e1699 apiv2: handle docker-java clients pulling
When docker-java calls images/create?fromImage=x, it expects two things
for a successful response: that both "error" and "errorDetail" are not
set, and that the "progress" message contains one of five hard-coded
strings ("Download complete" being one of them).

Signed-off-by: Igor Korolev <missterr@gmail.com>
2021-02-11 00:10:21 +04:00
OpenShift Merge Robot b4ca924365
Merge pull request #9297 from matejvasek/apiv2_push_get_digest
Docker [APIv2] push sends digest in response body
2021-02-10 08:52:36 -05:00
OpenShift Merge Robot 055e2dda3a
Merge pull request #9295 from Luap99/fix-9293
Fix compat networks endpoint for a empty result
2021-02-10 01:45:31 -05:00
Matej Vasek f4ece018b4 Docker APIv2 push sends digest in response body
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-02-10 02:03:28 +01:00
Paul Holzinger f2a8562031 Fix compat networks endpoint for a empty result
The networks list compat api endpoint must return `[]`
and not `null` if no networks are found.

Fixes #9293

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-09 23:03:48 +01:00
OpenShift Merge Robot a8c7aedc74
Merge pull request #9270 from matejvasek/fix_apiv2_push
Fix Docker APIv2 push endpoint
2021-02-09 14:30:12 -05:00
Matej Vasek 721a1e104e Fix Docker APIv2 push endpoint
Docker doesn't have the destination parameter as libpod does,
the "image name" path parameter is supposed to be the destination.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-02-09 18:20:15 +01:00
OpenShift Merge Robot f98605e0e4
Merge pull request #9125 from ashley-cui/secretswiring
Implement Secrets
2021-02-09 17:51:08 +01:00
Ashley Cui 832a69b0be Implement Secrets
Implement podman secret create, inspect, ls, rm
Implement podman run/create --secret
Secrets are blobs of data that are sensitive.
Currently, the only secret driver supported is filedriver, which means creating a secret stores it in base64 unencrypted in a file.
After creating a secret, a user can use the --secret flag to expose the secret inside the container at /run/secrets/[secretname]
This secret will not be commited to an image on a podman commit

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-02-09 09:13:21 -05:00
OpenShift Merge Robot 19507d0ffe
Merge pull request #9246 from rhatdan/build
Implement missing arguments for podman build
2021-02-08 14:18:31 -05:00
Daniel J Walsh 407e86dcd2
Implement missing arguments for podman build
Buildah bud passes a bunch more flags then podman build.

We need to implement hook up all of these flags to get full functionality.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-08 08:39:18 -05:00
baude 91ea3fabd6 add network prune
add the ability to prune unused cni networks.  filters are not implemented
but included both compat and podman api endpoints.

Fixes :#8673

Signed-off-by: baude <bbaude@redhat.com>
2021-02-06 07:37:29 -06:00
OpenShift Merge Robot 42d4652fed
Merge pull request #9048 from matejvasek/apiv2_wait
Fix Docker APIv2 container wait endpoint
2021-02-05 04:41:41 -05:00
OpenShift Merge Robot 4a0ae01261
Merge pull request #9182 from mheon/bump_api
Bump remote API version to 3.0.0
2021-02-05 04:10:29 -05:00
Matthew Heon 002f2aca70 Bump remote API version to 3.0.0
Fixes #9175

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-02-04 16:42:29 -05:00
Matej Vasek 4a219aa234 Implement Docker wait conditions
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-02-03 22:10:27 +01:00
Matej Vasek fc385806df Improve ContainerEngine.ContainerWait()
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-02-03 21:49:09 +01:00
OpenShift Merge Robot 4e1bcf30f3
Merge pull request #9188 from jwhonce/issues/8865
Report StatusConflict on Pod opt partial failures
2021-02-03 15:30:39 -05:00
Daniel J Walsh d87f54fbba
Fix invalid wait condition on kill
When using the compatability tests on kill, the kill
function goes into an infinite wait loop taking all of the CPU.

This change will use the correct wait function and exit properly.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-03 07:56:13 -05:00
Jhon Honce 7e4d696d94 Report StatusConflict on Pod opt partial failures
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

- Fix test_resize() result check

Fixes #8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-02-02 12:44:08 -07:00
OpenShift Merge Robot 81a3ba36ae
Merge pull request #9051 from rhatdan/rm
Switch podman stop/kill/wait handlers to use abi
2021-02-01 08:47:54 -05:00
Milivoje Legenovic 51c11fea8b Endpoint that lists containers does not return correct Status value
Eclipse and Intellij Docker plugin determines the state of the
container via the Status field, returned from /containers/json call.
Podman always returns empty string, and because of that, both IDEs
show the wrong state of the container.

Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
2021-01-31 21:06:39 +01:00
Daniel J Walsh 073f76c132
Switch podman stop/kill/wait handlers to use abi
Change API Handlers to use the same functions that the
local podman uses.

At the same time:

 implement remote API for --all and --ignore flags for podman stop
 implement remote API for --all flags for podman stop

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-29 14:04:44 -05:00
Daniel J Walsh d7c356552e
Podman-remote push can support --format
Fix man page to document podman push --format fully.

Also found that push was not handling the tlsverify so fixed this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-29 08:48:35 -05:00
OpenShift Merge Robot a4c255a939
Merge pull request #9115 from rhatdan/pull
Switch podman image push handlers to use abi
2021-01-28 14:37:30 -05:00
Daniel J Walsh 84f7bdc4db
Switch podman image push handlers to use abi
Change API Handlers to use the same functions that the
local podman uses.

At the same time:

Cleanup and pass proper bindings.  Remove cli options from
podman-remote push.  Cleanup manifest push.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-27 09:27:25 -05:00
Daniel J Walsh 21cb3043fc
podman-remote ps --external --pod --sort do not work.
Fixup the bindings and the handling of the --external --por and --sort
flags.

The --storage option was renamed --external, make sure we use
external up and down the stack.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-27 06:44:43 -05:00
OpenShift Merge Robot efcd48b966
Merge pull request #9070 from rhatdan/search
Fixup search
2021-01-26 13:05:55 +01:00
Daniel J Walsh 74a63df053
Fixup search
podman-remote search had some FIXMEs in tests that were failing.
So I reworked the search handler to use the local abi.  This
means the podman search and podman-remote search will use the
same functions.

While doing this, I noticed we were just outputing errors via
logrus.Error rather then returning them, which works ok for
podman but the messages get lost on podman-remote.  Changed
the code to actually return the error messages to the caller.

This allows us to turn on the remaining podman-remote FIXME
tests.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-25 18:01:22 -05:00
Daniel J Walsh 5623cb9d3d
Fix --arch and --os flags to work correctly
Currently podman implements --override-arch and --overide-os
But Podman has made these aliases for --arch and --os.  No
reason to have to specify --override, since it is clear what
the user intends.

Currently if the user specifies an --override-arch field but the
image was previously pulled for a different Arch, podman run uses
the different arch.  This PR also fixes this issue.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-25 14:58:24 -05:00
Reinhard Tartler ef76b92b80 swagger.go: Fix compilation error
Error looks like:

  # github.com/containers/podman/pkg/api/handlers/swagger
  src/github.com/containers/podman/pkg/api/handlers/swagger/swagger.go:169:3: undefined: libpod.InspectVolumeData

[NO TESTS NEEDED]

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2021-01-24 17:31:29 -05:00
Paul Holzinger 6e6a38b416 podman manifest exists
Add podman manifest exists command with remote support.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-22 20:19:13 +01:00
OpenShift Merge Robot 6fd83de31d
Merge pull request #9027 from Luap99/podman-volume-exists
Podman volume exists
2021-01-21 15:31:32 -05:00
Paul Holzinger 9d31fed5f7 podman volume exists
Add podman volume exists command with remote support.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-21 19:18:51 +01:00
OpenShift Merge Robot 55982295dd
Merge pull request #9036 from baude/composelog
Set log driver for compatibility containers
2021-01-21 05:48:38 -05:00
baude f430467453 Set log driver for compatability containers
when using the compatibility api to create containers, now reflect the
use of k8s-file as json-file so that clients, which are
unaware of k8s-file, can work.  specifically, if the container is using
k8s-file as the log driver, we change the log type in container
inspection to json-file.  These terms are used interchangably in other
locations in libpod/podman.

this fixes log messages in compose as well.

[NO TESTS NEEDED]

Signed-off-by: baude <bbaude@redhat.com>
2021-01-20 13:07:31 -06:00
Daniel J Walsh e7df73efad
Fix handling of container remove
I found several problems with container remove

podman-remote rm --all
Was not handled

podman-remote rm --ignore
Was not handled

Return better errors when attempting to remove an --external container.
Currently we return the container does not exists, as opposed to container
is an external container that is being used.

This patch also consolidates the tunnel code to use the same code for
removing the container, as the local API, removing duplication of code
and potential problems.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-20 07:37:13 -05:00
Paul Holzinger a45d22a1dd podman network exists
Add podman network exists command with remote support.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-19 15:18:03 +01:00
Daniel J Walsh cf51c7ed9f
Allow podman push to push manifest lists
When doing a podman images, manifests lists look just like images, so
it is logical that users would assume that they can just podman push them
to a registry.  The problem is we throw out weird errors when this happens
and users need to somehow figure out this is a manifest list rather then
an image, and frankly the user will not understand the difference.

This PR will make podman push just do the right thing, by failing over and
attempting to push the manifest if it fails to push the image.

Fix up handling of manifest push

Protocol should bring back a digest string, which can either be
printed or stored in a file.

We should not reimplement the manifest push setup code in the tunnel
code but take advantage of the api path, to make sure remote and local
work the same way.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-15 13:24:34 -05:00
OpenShift Merge Robot 3fcf346890
Merge pull request #8955 from mheon/rename
Container Rename
2021-01-14 22:03:01 -05:00
Matthew Heon 997de2f8e9 Initial implementation of renaming containers
Basic theory: We remove the container, but *only from the DB*.
We leave it in c/storage, we leave the lock allocated, we leave
it running (if it is). Then we create an identical container with
an altered name, and add that back to the database. Theoretically
we now have a renamed container.

The advantage of this approach is that it doesn't just apply to
rename - we can use this to make *any* configuration change to a
container that does not alter its container ID.

Potential problems are numerous. This process is *THOROUGHLY*
non-atomic at present - if you `kill -9` Podman mid-rename things
will be in a bad place, for example. Also, we can't rename
containers that can't be removed normally - IE, containers with
dependencies (pod infra containers, for example).

The largest potential improvement will be to move the majority of
the work into the DB, with a `RecreateContainer()` method - that
will add atomicity, and let us remove the container without
worrying about depencies and similar issues.

Potential problems: long-running processes that edit the DB and
may have an older version of the configuration around. Most
notable example is `podman run --rm` - the removal command needed
to be manually edited to avoid this one. This begins to get at
the heart of me not wanting to do this in the first place...

This provides CLI and API implementations for frontend, but no
tunnel implementation. It will be added in a future release (just
held back for time now - we need this in 3.0 and are running low
on time).

This is honestly kind of horrifying, but I think it will work.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-01-14 18:29:28 -05:00
Matthew Heon b53cb57680 Initial implementation of volume plugins
This implements support for mounting and unmounting volumes
backed by volume plugins. Support for actually retrieving
plugins requires a pull request to land in containers.conf and
then that to be vendored, and as such is not yet ready. Given
this, this code is only compile tested. However, the code for
everything past retrieving the plugin has been written - there is
support for creating, removing, mounting, and unmounting volumes,
which should allow full functionality once the c/common PR is
merged.

A major change is the signature of the MountPoint function for
volumes, which now, by necessity, returns an error. Named volumes
managed by a plugin do not have a mountpoint we control; instead,
it is managed entirely by the plugin. As such, we need to cache
the path in the DB, and calls to retrieve it now need to access
the DB (and may fail as such).

Notably absent is support for SELinux relabelling and chowning
these volumes. Given that we don't manage the mountpoint for
these volumes, I am extremely reluctant to try and modify it - we
could easily break the plugin trying to chown or relabel it.

Also, we had no less than *5* separate implementations of
inspecting a volume floating around in pkg/infra/abi and
pkg/api/handlers/libpod. And none of them used volume.Inspect(),
the only correct way of inspecting volumes. Remove them all and
consolidate to using the correct way. Compat API is likely still
doing things the wrong way, but that is an issue for another day.

Fixes #4304

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-01-14 15:35:33 -05:00
baude 827f6c9cb0 Reduce general binding binary size
when using the bindings to *only* make a connection, the binary was
rough 28MB.  This PR reduces it down to 11.  There is more work to do
but it will come in a secondary PR.

Signed-off-by: baude <bbaude@redhat.com>
2021-01-13 09:35:24 -06:00
Daniel J Walsh 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
Paul Holzinger 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
Paul Holzinger 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
OpenShift Merge Robot 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
Jhon Honce 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
Radostin Stoyanov 288ccc4c84 Include named volumes in container migration
When migrating a container with associated volumes, the content of
these volumes should be made available on the destination machine.

This patch enables container checkpoint/restore with named volumes
by including the content of volumes in checkpoint file. On restore,
volumes associated with container are created and their content is
restored.

The --ignore-volumes option is introduced to disable this feature.

Example:

 # podman container checkpoint --export checkpoint.tar.gz <container>

The content of all volumes associated with the container are included
in `checkpoint.tar.gz`

 # podman container checkpoint --export checkpoint.tar.gz --ignore-volumes <container>

The content of volumes is not included in `checkpoint.tar.gz`. This is
useful, for example, when the checkpoint/restore is performed on the
same machine.

 # podman container restore --import checkpoint.tar.gz

The associated volumes will be created and their content will be
restored. Podman will exit with an error if volumes with the same
name already exist on the system or the content of volumes is not
included in checkpoint.tar.gz

 # podman container restore --ignore-volumes --import checkpoint.tar.gz

Volumes associated with container must already exist. Podman will not
create them or restore their content.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-01-07 07:51:19 +00:00
OpenShift Merge Robot b84b7c89bb
Merge pull request #8831 from bblenard/issue-8658-system-prune-reclaimed-space
Rework pruning to report reclaimed space
2021-01-05 11:35:18 -05:00
Valentin Rothberg acbec396fd libpod API: pull: fix channel race
Fix a race condition in the pull endpoint caused by buffered channels.
Using buffered channels can lead to the context's cancel function to be
executed prior to the items being read from the channel.

Fixes: #8870
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-04 17:46:24 +01:00
Paul Holzinger f471fb4ce9 Compat api containers/json add support for filters
Fixes #8860

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-01 22:43:31 +01:00
Jhon Honce a0bfd953c2 Expose Height/Width fields to decoder
Fixes #7102

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-12-30 19:27:48 -07:00
Baron Lenardson b90f7f9095 Rework pruning to report reclaimed space
This change adds code to report the reclaimed space after a prune.
Reclaimed space from volumes, images, and containers is recorded
during the prune call in a PruneReport struct. These structs are
collected into a slice during a system prune and processed afterwards
to calculate the total reclaimed space.

Closes #8658

Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
2020-12-30 19:57:35 -06:00
Baron Lenardson 76afb50f3a Consolidate filter logic to pkg subdirectory
Per the conversation on pull/8724 I am consolidating filter logic
and helper functions under the pkg/domain/filters dir.

Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
2020-12-24 20:27:41 +00:00
Josh Soref 4fa1fce930 Spelling
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-12-22 13:34:31 -05:00
Valentin Rothberg adcb3a7a60 remote copy
Implement `podman-remote cp` and break out the logic from the previously
added `pkg/copy` into it's basic building blocks and move them up into
the `ContainerEngine` interface and `cmd/podman`.

The `--pause` and `--extract` flags are now deprecated and turned into
nops.

Note that this commit is vendoring a non-release version of Buildah to
pull in updates to the copier package.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-12-18 12:08:49 +01:00
OpenShift Merge Robot a17afa931d
Merge pull request #8752 from baude/bindings3volumes
misc bindings to podman v3
2020-12-17 17:22:37 +00:00
baude 86335aa4ae misc bindings to podman v3
manifest, system, info, volumes, play,  and generate bindings are
updated to always have binding options.

Signed-off-by: baude <bbaude@redhat.com>
2020-12-17 09:40:51 -06:00
Milivoje Legenovic 29358e3e09 Docker compat API - /images/search returns wrong structure (#7857)
Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
2020-12-17 12:50:44 +01:00
OpenShift Merge Robot 978c0767fa
Merge pull request #8715 from baude/bindings3images
Podman image bindings for 3.0
2020-12-16 14:04:11 +00:00
baude 8d4e19634c Podman image bindings for 3.0
Begin the migration of the image bindings for podman 3.0.  this includes
the use of options for each binding.  build was intentionally not
converted as I believe it needs more discussion before migration.
specifically, the build options themselves.

also noteworthly is that the remove image and remove images bindings
were merged into one.  the remove images (or batch remove) has one
downside in that the errors return no longer adhere to http return
codes.  this should be discussed and reimplemented in subsequent code.

Signed-off-by: baude <bbaude@redhat.com>
2020-12-15 16:04:59 -06:00
Matej Vasek af36d444a5 Clean up temporary file.
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-12-15 16:07:43 +01:00
OpenShift Merge Robot 0fd31e2994
Merge pull request #8696 from Luap99/podman-events-until
podman events allow future time for --until
2020-12-14 09:33:42 -05:00
OpenShift Merge Robot e5741b984e
Merge pull request #8689 from bblenard/issue-8672-volume-prune
Add volume prune --filter support
2020-12-14 09:22:30 -05:00
Baron Lenardson a0204ada09 Add volume prune --filter support
This change adds support for the `--filter` / `?filters` arguments on
the `podman volume prune` subcommand.

  * Adds ParseFilterArgumentsIntoFilters helper for consistent
    Filter string slice handling
  * Adds `--filter` support to podman volume prune cli
  * Adds `?filters...` support to podman volume prune api
  * Updates apiv2 / e2e tests

Closes #8672

Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
2020-12-12 20:07:04 -06:00
Paul Holzinger 74fcd9fef3 podman events allow future time for --until
The podman events aren't read until the given timestamp if the
timestamp is in the future. It just reads all events until now
and exits afterwards.
This does not make sense and does not match docker. The correct
behavior is to read all events until the given time is reached.

This fixes a bug where the wrong event log file path was used
when running first time with a new storage location.
Fixes #8694

This also fixes the events api endpoint which only exited when
an error occurred. Otherwise it just hung after reading all events.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-11 23:15:09 +01:00
OpenShift Merge Robot 99ac30a882
Merge pull request #8690 from zhangguanzhang/apiv2-wrong-ImgName
Fix Wrong img name used when creating a container from an image which had multi names
2020-12-11 10:20:16 -05:00
Paul Holzinger 2a35387e9e Fix some network compat api problems
Network create could panic when used with a json body like this:
`{"Name":"net","IPAM":{"Config":[]}}`

The network scope for list and inspect should not be empty. It can
be swarm, global or local. We only support local networks so
hardcode this field to local.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-11 14:16:05 +01:00
zhangguanzhang fb25f737e5 Fix Wrong image tag is used when creating a container from an image with multiple tags
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-12-11 20:02:41 +08:00
Paul Holzinger 3fa61f0004 Fix panic in libpod images exists endpoint
The libpod images exists endpoint panics when called with
a non existing image and therefore returns 500 as status
code instead of the expected 404.

A test is added to ensure it is working.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-10 14:35:17 +01:00
OpenShift Merge Robot 6db3e9bfeb
Merge pull request #8653 from rhatdan/buildah
Honor the --layers flag
2020-12-09 14:58:28 -05:00
Daniel J Walsh 0154f9e9b3
Honor the --layers flag
Currently the --layers flag set by the user is ignored, and only the BUILDAH_LAYERS
environment variable being set is observed.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-09 08:31:36 -05:00
Valentin Rothberg a12323884f pkg/copy: introduce a Copier
Introduce a `Copier` object to separate the copy-rule enforcement from
copying.  That allows for a better error reporting of the REST API.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-12-09 14:05:17 +01:00
Valentin Rothberg c2a5011c0d archive: move stat-header handling into copy package
Move handling the stat header into `pkg/copy`.  All copy-related should
ideally be located in this package to increase locality and reduce
scattering where possible.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-12-09 12:03:00 +01:00
baude 749ee2a10e generate kube on multiple containers
add the ability to add multiple containers into a single k8s pod
instead of just one.

also fixed some bugs in the resulting yaml where an empty service
description was being added on error causing the k8s validation to fail.

Signed-off-by: baude <bbaude@redhat.com>
2020-12-07 11:34:39 -06:00
Milivoje Legenovic 4a2498ff36 Docker compat API - containers create ignores the name
/containers/create compat endpoint does not set the name correctly (#7857)

Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
2020-12-07 14:28:50 +01:00
Jhon Honce 98c1b23624 Jira RUN-1106 System handlers updates
* Update tests to reflect system endpoints
* First implementation of compat /system/df, only fields that are
  populated by libpod are set

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-12-05 16:41:57 -07:00
Jhon Honce 9b11fc00f1 Jira RUN-1106 Volumes handlers updates
* Add tests to verify required fields in responses

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-12-04 16:27:42 -07:00
OpenShift Merge Robot 8e83799d58
Merge pull request #8601 from jwhonce/jira/RUN-1106-networks
Jira RUN-1106 Network handlers updates
2020-12-04 17:45:58 -05:00
OpenShift Merge Robot b6536d20ed
Merge pull request #8494 from mlegenovic/master
More docker compat API fixes
2020-12-04 15:48:20 -05:00
Jhon Honce 53c8bc5a5e Jira RUN-1106 Network handlers updates
* Add network API tests
* Update network create endpoint to return ID not Name

Audit:
- GET /networks ListNetworks
- GET /networks/{id} InspectNetwork
- DELETE /networks/{id} RemoveNetwork
- POST /networks/create CreateNetwork
- POST /networks/prune 405 not implemented

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-12-04 13:44:33 -07:00
OpenShift Merge Robot 0f496e4b81
Merge pull request #8570 from vrothberg/run-950
rewrite container copy
2020-12-04 13:33:36 -05:00
OpenShift Merge Robot a2d536e597
Merge pull request #8584 from jwhonce/jira/RUN-1106-containers
Jira RUN-1106 Container handlers updates
2020-12-04 11:15:27 -05:00
Milivoje Legenovic 15d36f120c More docker compat API fixes
Fixes wrong VirtualSize, ParentId, Architecture, Author, Os and OsVersion value

Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
2020-12-04 15:58:46 +01:00
Valentin Rothberg ccbca0b4ab rewrite podman-cp
* Add a new `pkg/copy` to centralize all container-copy related code.

* The new code is based on Buildah's `copier` package.

* The compat `/archive` endpoints use the new `copy` package.

* Update docs and an several new tests.

* Includes many fixes, most notably, the look-up of volumes and mounts.

Breaking changes:

 * Podman is now expecting that container-destination paths exist.
   Before, Podman created the paths if needed.  Docker does not do
   that and I believe Podman should not either as it's a recipe for
   masking errors.  These errors may be user induced (e.g., a path
   typo), or internal typos (e.g., when the destination may be a
   mistakenly unmounted volume).  Let's keep the magic low for such
   a security sensitive feature.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-12-04 14:39:55 +01:00
Jhon Honce 468947d5c8 Jira RUN-1106 Image handlers updates
* Audit and add tests for required fields.
* Added issue for /images/load implementation

Audit:
- GET /images/json GetImages
- POST /build BuildImage
- POST /build/prune 404 not found
- POST /images/create CreateImageFromImage/CreateImageFromSrc
- GET /images/{name}/json GetImage
- GET /images/{name}/history HistoryImage
- POST /images/{name}/push PushImage
- POST /images/{name}/tag TagImage
- DELETE /images/{name} RemoveImage
- POST /images/prune PruneImages
- POST /commit CommitContainer
- GET /images/{name}/get ExportImage
- GET /images/get ExportImages
- POST /images/load LoadImages See https://github.com/containers/podman/issues/8586

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-12-03 16:11:17 -07:00
Jhon Honce 767afe01db Jira RUN-1106 Container handlers updates
Mostly audit and minor changes to nil from ""

Audit:
- GET /containers/json ListContainers
- POST /containers/create CreateContainer
- GET /containers/{id}/json GetContainer
- GET /containers/{id}/top TopContainer
- GET /containers/{id}/logs LogsFromContainer
- GET /containers/{id}/changes Changes
- GET /containers/{id}/export ExportContainer
- GET /containers/{id}/stats StatsContainer
- POST /containers/{id}/resize ResizeTTY
- POST /containers/{id}/start StartContainer
- POST /containers/{id}/stop StopContainer
- POST /containers/{id}/restart RestartContainer
- POST /containers/{id}/kill KillContainer
- POST /containers/{id}/update 404 not supported
- POST /containers/{id}/rename 404 not supported
- POST /containers/{id}/pause PauseContainer
- POST /containers/{id}/unpause UnpauseContainer
- POST /containers/{id}/attach AttachContainer
- GET /containers/{id}/attach/ws 404 not supported
- POST /containers/{id}/wait WaitContainer
- DELETE /containers/{id} RemoveContainer
- HEAD /containers/{id}/archive Archive
- GET /containers/{id}/archive Archive
- PUT /containers/{id}/archive Archive
- POST /containers/prune PruneContainers

Images etc PR's will follow.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-12-03 13:49:22 -07:00
Daniel J Walsh f00cc25a7c
Drop default log-level from error to warn
Our users are missing certain warning messages that would
make debugging issues with Podman easier.

For example if you do a podman build with a Containerfile
that contains the SHELL directive, the Derective is silently
ignored.

If you run with the log-level warn you get a warning message explainging
what happened.

$ podman build --no-cache -f /tmp/Containerfile1 /tmp/
STEP 1: FROM ubi8
STEP 2: SHELL ["/bin/bash", "-c"]
STEP 3: COMMIT
--> 7a207be102a
7a207be102aa8993eceb32802e6ceb9d2603ceed9dee0fee341df63e6300882e

$ podman --log-level=warn build --no-cache -f /tmp/Containerfile1 /tmp/
STEP 1: FROM ubi8
STEP 2: SHELL ["/bin/bash", "-c"]
STEP 3: COMMIT
WARN[0000] SHELL is not supported for OCI image format, [/bin/bash -c] will be ignored. Must use `docker` format
--> 7bd96fd25b9
7bd96fd25b9f755d8a045e31187e406cf889dcf3799357ec906e90767613e95f

These messages will no longer be lost, when we default to WARNing level.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-03 06:28:09 -05:00
OpenShift Merge Robot e74072e742
Merge pull request #8112 from QiWang19/load-optional-name
Drop name argument from Load API
2020-12-02 21:35:31 +01:00
OpenShift Merge Robot e82ec90007
Merge pull request #8552 from baude/buildtarget
target is not tag
2020-12-02 16:58:28 +01:00
Qi Wang f525d8b843 Do not pass name argument to Load API
Not pass the name argument to Load API. Specify in the document the usage of the optional argument is tagging an additional image.
Close #7337

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-12-02 09:25:01 -05:00
baude 3a5cd57bb4 target is not tag
remove mistaken use of target being used for tag

Signed-off-by: baude <bbaude@redhat.com>
2020-12-02 08:21:03 -06:00
Paul Holzinger c31a5c0d9c Add support for network ids
The network ID is not stored. It is just the sha256 hash from
the network name. There is a risk of a potential hash collision.
However it's very unlikely and even if we hit this it will
complain that more than network with this ID exists.

The main benefit is that the compat api can have proper
network ID support. Also this adds the support for
`podman network ls --format "{{.ID}}"` and `--filter id=<ID>`.

It also ensures that we can do network rm <ID> and network
inspect <ID>.

Since we use a hash this commit is backwards compatible even for
already existing networks.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-02 10:27:00 +01:00
OpenShift Merge Robot b7ff6f0912
Merge pull request #8505 from Luap99/network-labels
podman network label support
2020-12-01 21:43:27 +01:00
OpenShift Merge Robot ce45b71dcf
Merge pull request #8126 from matejvasek/impl-apiv2-archive
Implement containers/{id or name}/archive api
2020-12-01 19:56:49 +01:00
OpenShift Merge Robot e3f0b7db75
Merge pull request #8400 from rhatdan/varlink
Remove varlink support from podman
2020-12-01 15:30:06 +01:00
Daniel J Walsh 9ba52e8ef0
Document docker transport is the only supported remote transport
The goal is to improve errors when users use the wrong transport
in certain cases we stutter, in other cases we don't give enough
information.

Remove stutters when failing to pull remote images, because of
lack of support.

Fix errors returned by reference.Parse to wrap in image that was being
checked.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-29 06:28:39 -05:00
Paul Holzinger 8494bcb866 podman network label support
Add label support for podman network create. Use the `args`
field in the cni config file to store the podman labels.
Use `podman_labels` as key name and store the labels as
map[string]string.

For reference: https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#args-in-network-config
https://github.com/containernetworking/cni/blob/spec-v0.4.0/SPEC.md#network-configuration

Example snippet:

```
...
"args": {
	"podman_labels": {
		"key1":"value1",
		"key2":"value2"
	}
}
...
```

Make podman network list support several filters. Supported filters are name,
plugin, driver and label. Filters with different keys work exclusive. Several label
filters work exclusive and the other filter keys are working inclusive.

Also adjust the compat api to support labels in network create and list.

Breaking changes:

- podman network ls -f shortform is used for --filter instead --format
This matches docker and other podman commands (container ps, volume ps)

- libpod network list endpoint filter parameter is removed. Instead the
filters paramter should be used as json encoded map[string][]string.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-28 18:35:43 +01:00
Daniel J Walsh f62a356515
Remove varlink support from Podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-26 16:50:42 -05:00
OpenShift Merge Robot ad2439264d
Merge pull request #8487 from riyad/fix-ping-typo
REST API v2 - ping - fix typo in header
2020-11-26 16:41:53 +01:00
Riyad Preukschas 0ae1221a46 REST API v2 - ping - fix typo in header
Signed-off-by: Riyad Preukschas <riyad@informatik.uni-bremen.de>
2020-11-25 20:49:08 +01:00
Riyad Preukschas af6106f3ff REST API v2 - ping - remove newline from response to improve Docker compatibility
Signed-off-by: Riyad Preukschas <riyad@informatik.uni-bremen.de>
2020-11-25 20:43:36 +01:00
Jhon Honce 44da01f45c Refactor compat container create endpoint
* Make endpoint compatibile with docker-py network expectations
* Update specgen helper when called from compat endpoint
* Update godoc on types
* Add test for network/container create using docker-py method
* Add syslog logging when DEBUG=1 for tests

Fixes #8361

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-23 15:20:39 -06:00
OpenShift Merge Robot 5d55285188
Merge pull request #8409 from mlegenovic/master
Docker compat API fixes
2020-11-23 21:17:05 +01:00
Milivoje Legenovic 6f7b7060e8 [WIP] Docker compat API fixes
These are the first fixes that are needed for development environments like
Eclipse or IntelliJ that have Docker plug-ins and use the Docker API to speak
with container engine (#7857)

Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
2020-11-23 17:45:24 +01:00
OpenShift Merge Robot dd343418ce
Merge pull request #8263 from rhatdan/restart
Allow containers to --restart on-failure with --rm
2020-11-23 13:44:37 +01:00
Petr Sakař 435f61f497 APIv2 - strip CAP_ prefix from capabilities in json
strip prefix "CAP_" from capabilities in json generated by container inspect operation

Signed-off-by: Petr Sakař <petr.sakar@chare.eu>
2020-11-20 21:46:51 +01:00
Daniel J Walsh dc8996ec84
Allow containers to --restart on-failure with --rm
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-20 13:55:19 -05:00
Matej Vasek 4d0346c028 not forcing unmount
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-11-19 20:31:47 +01:00
Matej Vasek be7e9f63f2 add comment
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-11-19 20:31:47 +01:00
Matej Vasek 6ad2f1d248 fix: unmount container without force
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-11-19 20:31:47 +01:00
Matej Vasek 7da4083549 style: wsl
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-11-19 20:31:47 +01:00
Matej Vasek 430729a391 fix lint
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-11-19 20:31:47 +01:00
Matej Vasek 4e2d18db90 Implement containers/{id or name}/archive
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-11-19 20:31:47 +01:00
OpenShift Merge Robot e239bfa15b
Merge pull request #8391 from baude/networkconnectdisconnect
add network connect|disconnect compat endpoints
2020-11-19 16:54:29 +01:00
baude a3e0b7d117 add network connect|disconnect compat endpoints
this enables the ability to connect and disconnect a container from a
given network. it is only for the compatibility layer. some code had to
be refactored to avoid circular imports.

additionally, tests are being deferred temporarily due to some
incompatibility/bug in either docker-py or our stack.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-19 08:16:19 -06:00
OpenShift Merge Robot b1007caca5
Merge pull request #8379 from rhatdan/remote2
Remove build \!remote flags from test phase 2
2020-11-18 22:51:52 +01:00
Paul Holzinger e7fd9234cd Align the podman pod ps --filter behavior with podman ps
Filters with the same key work inclusive with the only exception being
`label` which is exclusive. Filters with different keys always work exclusive.

Also update the documentation with the new behavior.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-18 19:31:25 +01:00
Daniel J Walsh 3b6d7a3669
Remove build \!remote flags from test phase 2
Add some more tests, document cases where remote will not work
Add FIXMEs for tests that should work on podman-remote but currently
do not.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-18 13:02:44 -05:00
Daniel J Walsh 72b67715f8
podman-remote network rm --force is broken
The --force parameter was not being handled correctly.
This is leading to some race conditions in testing failures.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-18 12:57:39 -05:00
OpenShift Merge Robot 61a82159db
Merge pull request #8376 from Luap99/podman-filters
Align the podman ps --filter behavior with docker
2020-11-18 18:55:05 +01:00
Paul Holzinger 4f427a89cb Align the podman ps --filter behavior with docker
All of our filters worked exclusive resulting in `--filter status=created --filter status=exited` to return nothing.

In docker filters with the same key work inclusive with the only exception being `label` which is exclusive. Filters with different keys always work exclusive.

This PR aims to match the docker behavior with podman.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-18 11:36:06 +01:00
OpenShift Merge Robot 8a0c3d878b
Merge pull request #8355 from baude/compatnetworkconnectdisconnect
add network connect|disconnect compat endpoints
2020-11-17 23:18:48 +01:00
baude d3e794bda3 add network connect|disconnect compat endpoints
this enables the ability to connect and disconnect a container from a
given network. it is only for the compatibility layer. some code had to
be refactored to avoid circular imports.

additionally, tests are being deferred temporarily due to some
incompatibility/bug in either docker-py or our stack.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-17 14:22:39 -06:00
Alban Bedel 7ab936eafa Add an option to control if play kube should start the pod
Having play kube start the pod is not always appropriate, one might
for example like to have the pod running as a set of systemd services.
Add a `start` option to the command line and API to control if the pod
should be started or not; it defaults to true for backward
compatibility.

Signed-off-by: Alban Bedel <albeu@free.fr>
2020-11-17 20:00:58 +01:00
OpenShift Merge Robot 4eb9c28433
Merge pull request #8333 from rhatdan/buildah
Podman-remote build is getting ID twice
2020-11-14 15:10:09 +01:00
Daniel J Walsh b5e15f18d0
Podman-remote build is getting ID twice
This PR eliminates the second sending of the image id to the
podman-remote client.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-14 06:25:29 -05:00
Jhon Honce a1187ee6f3 Refactor to use DockerClient vs APIClient
* Update tests and framework
* remove tests for APIClient methods

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-12 15:13:09 -07:00
baude b917b9925c Set default network driver for APIv2 networks
Recent changes in networking require that the cni network driver be set.
If the user provides no driver, we set the driver to the
defaultnetworkdriver which currently is "bridge".

Fixes: #8294

Signed-off-by: baude <bbaude@redhat.com>
2020-11-10 14:00:54 -06:00
OpenShift Merge Robot da95fb4226
Merge pull request #8270 from andylibrian/log-driver-option-for-play-kube
Add --log-driver to play kube
2020-11-10 12:29:19 +00:00
OpenShift Merge Robot 716f70b5c5
Merge pull request #8236 from jwhonce/jira/run-976
Update CI tests to run python docker library against API
2020-11-09 20:08:29 +00:00
Jhon Honce 2d50ec6996 Update CI tests to run python docker library against API
* Update reference to docker-py to docker to reflect change in library
  name
* Update tests to create storage sandbox
* Enable all tests that endpoints support
* Refactor containers/{id}/rename to return 404 not 500
* Refactor tests to use quay.io vs. docker.io

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-09 10:45:54 -07:00
Andy Librian f3355d9697
Add --log-driver to play kube
addresses #6604

Signed-off-by: Andy Librian <andylibrian@gmail.com>
2020-11-08 08:59:18 +07:00
baude 71a4676404 rootless container creation settings
when running container creation as rootless on the compatibility layer,
we need to make sure settings are not being done for memory and memory
swappiness.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-05 12:27:48 -06:00
Daniel J Walsh 99d3e2e9d7
NewFromLocal can return multiple images
If you use additional stores and pull the same image into
writable stores, you can end up with the situation where
you have the same image twice. This causes image exists
to return the wrong error.  It should return true in this
situation rather then an error.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-28 16:02:53 -04:00
Ashley Cui 61deec451f Add pod, volume, network to inspect package
podman inspect only had the capabilities to inspect containers and images. if a user wanted to inspect a pod, volume, or network, they would have to use `podman network inspect`, `podman pod inspect` etc. Docker's cli allowed users to inspect both volumes and networks using regular inspect, so this commit gives the user the functionality

If the inspect type is not specified using --type, the order of inspection is:

containers
images
volumes
networks
pods

meaning if container that has the same name as an image, podman inspect would return the container inspect.

To avoid duplicate code, podman network inspect and podman volume inspect now use the inspect package as well. Podman pod inspect does not because podman pod inspect returns a single json object while podman inspect can return multiple)

Signed-off-by: Ashley Cui <acui@redhat.com>
2020-10-27 14:42:54 -04:00
OpenShift Merge Robot 51fa8ded9f
Merge pull request #8109 from matejvasek/inspect-apiv2-rootfs
fix: /image/{name or id}/json returns RootFS layers
2020-10-23 07:01:03 -04:00
OpenShift Merge Robot a53a660313
Merge pull request #8078 from baude/networkdisconnect
APIv2 compatibility network connect|disconnect
2020-10-22 16:19:11 -04:00
Matej Vasek a997b59e44 src: nil check
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-10-22 20:05:01 +02:00
Matej Vasek 5098048f82 src: add nil checks
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-10-22 18:33:15 +02:00
Matej Vasek 89e7b8f22b fix: /image/{name}/json returns RootFS layers
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-10-22 17:09:44 +02:00
OpenShift Merge Robot 513c2610f3
Merge pull request #7956 from QiWang19/save-rm-sig
Allow save image remove-signatures
2020-10-22 11:00:09 -04:00
baude 6841936525 APIv2 compatibility network connect|disconnect
Add endpoints for the compat layer for network connect and disconnect. As of now, these two endpoints do nothing to change the network state of a container.  They do some basic data verification and return the proper 200 response.  This at least allows for scripts to work on the compatibility layer instead of getting 404s.

Signed-off-by: baude <bbaude@redhat.com>
2020-10-22 08:20:28 -05:00
baude cf227cc7f2 set compat network driver default
when using the compatibility endpoint for creating a network, if the driver is not provided, we need to set it to the default network driver ... which is bridge.

Signed-off-by: baude <bbaude@redhat.com>
2020-10-21 14:48:29 -05:00
OpenShift Merge Robot 61b276a05c
Merge pull request #8083 from crunchtime-ali/add-eol-to-compat-log
Add EOL to compat container logs
2020-10-21 15:31:08 -04:00
Alexander Zigelski b26c6519ac
Add EOL to compat container logs
Signed-off-by: Alexander Zigelski <ali@crunchtime.dev>
2020-10-21 16:21:28 +02:00
Qi Wang b898f914a3 save image remove signatures
remove signatures to podman save since the image formats do not support signatures
Close: #7659

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-10-21 10:00:08 -04:00
OpenShift Merge Robot d5073af6b2
Merge pull request #8022 from baude/compatapitospecgen
refactor api compatibility container creation to specgen
2020-10-21 06:35:51 -04:00
OpenShift Merge Robot 4822cc8cab
Merge pull request #8042 from rhatdan/tlsverify
--tls-verify and --authfile should work for all remote commands
2020-10-20 15:34:56 -04:00
baude eb91d66c4a refactor api compatibility container creation to specgen
when using the compatibility layer to create containers, it used code paths to the pkg/spec which is the old implementation of containers.  it is error prone and no longer being maintained.  rather that fixing things in spec, migrating to specgen usage seems to make the most sense.  furthermore, any fixes to the compat create will not need to be ported later.

Signed-off-by: baude <bbaude@redhat.com>
2020-10-20 12:06:59 -05:00
Matej Vasek bacdbf6e20 fix: neutral value for MemorySwappiness
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-10-20 03:13:56 +02:00
Daniel J Walsh 3d2ad0f97a
--tls-verify and --authfile should work for all remote commands
These options are now fully supported in the remote API and should no
longer be hidden and/or documented as non supported.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-19 05:55:11 -04:00
Daniel J Walsh db23e12611
Add support for external container
External containers are containers created outside of Podman.
For example Buildah and CRI-O Containers.

$ buildah from alpine
alpine-working-container
$ buildah run alpine-working-container touch /test
$ podman container exists --external alpine-working-container

$ podman container diff alpine-working-container
C /etc
A /test

Added --external flag to refer to external containers, rather then --storage.

Added --external for podman container exists and modified podman ps to use
--external rather then --storage.  It was felt that --storage would confuse
the user into thinking about changing the storage driver or options.

--storage is still supported through the use of aliases.

Finally podman contianer diff, does not require the --external flag, since it
there is little change of users making the mistake, and would just be a pain
for the user to remember the flag.

podman container exists --external is required because it could fool scripts
that rely on the existance of a Podman container, and there is a potential
for a partial deletion of a container, which could mess up existing users.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-15 09:51:31 -04:00
Daniel J Walsh 22c8270135
fix podman container exists and diff for storage containers
Current these commands only check if a container exists in libpod. With
this fix, the commands will also check if they are in containers/storage.

This allows users to look at differences within a buildah or CRI-O container.

Currently buildah diff does not exists, so this helps out in that situation
as well as in CRI-O since the cri does not implement a diff command.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-15 09:51:15 -04:00
OpenShift Merge Robot e3eb6fd0e4
Merge pull request #7987 from jwhonce/jira/run-898-5
Restore --format table support
2020-10-14 13:07:11 -04:00
Jhon Honce eb4a746efc Restore --format table support
* system df
* events
  * fix error handling from go routine
  * update tests to use gomega matchers for better error messages
* system info
* version
* volume inspect

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-10-13 17:28:45 -07:00
baude ef5c884673 alter compat no such image message
we need to alter the return error message when a GET (inspect) is performed on an image using the compatibility layer.  docker-py bindings look for a initial capped error message.

Signed-off-by: baude <bbaude@redhat.com>
2020-10-13 12:11:52 -05:00
OpenShift Merge Robot 212011f166
Merge pull request #7836 from QiWang19/search-tags
Search repository tags using --list-tags
2020-10-12 07:01:10 -04:00
OpenShift Merge Robot dce30de594
Merge pull request #7980 from 3sky/compatibility-api-timestamp
Resolve #7860 - add time.RFC3339 format
2020-10-12 06:53:40 -04:00
3sky 1fc64c8a5a Resolve #7860 - add time.RFC3339Nano into ContainerJSONBase
Signed-off-by: 3sky <3sky@protonmail.com>
2020-10-12 08:51:47 +02:00
Jhon Honce 0cdb10448a Monitor for client closing stream
Fixes #7946

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-10-09 15:39:29 -07:00
Qi Wang 66798e993a Search repository tags using --list-tags
For fix of BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1684263
Add --list-tags to podman search to return a table the repository tags.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-10-09 11:49:46 -04:00
OpenShift Merge Robot 2a63795338
Merge pull request #7966 from baude/issue7950
add compatibility endpoint for exporting multiple images
2020-10-08 18:11:59 -04:00
OpenShift Merge Robot 1b90cb95c5
Merge pull request #7952 from baude/issue7934
APIv2 compatibility rootless network fix
2020-10-08 16:41:21 -04:00
baude 78a06c2802 add compatibility endpoint for exporting multiple images
with the recent inclusion of dealing with multiple images in a tar archive, we can now add a compatibility endpoint that was missing images/get?names=one,two.

Fixes: #7950

Signed-off-by: baude <bbaude@redhat.com>
2020-10-08 11:55:47 -05:00
OpenShift Merge Robot 0e1d01103e
Merge pull request #7382 from mheon/pod_parallel
Move pod jobs to parallel execution
2020-10-07 15:06:02 -04:00