374 Commits

Author SHA1 Message Date
bacdbf6e20 fix: neutral value for MemorySwappiness
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-10-20 03:13:56 +02:00
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
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
e3eb6fd0e4 Merge pull request #7987 from jwhonce/jira/run-898-5
Restore --format table support
2020-10-14 13:07:11 -04:00
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
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
212011f166 Merge pull request #7836 from QiWang19/search-tags
Search repository tags using --list-tags
2020-10-12 07:01:10 -04:00
dce30de594 Merge pull request #7980 from 3sky/compatibility-api-timestamp
Resolve #7860 - add time.RFC3339 format
2020-10-12 06:53:40 -04:00
1fc64c8a5a Resolve #7860 - add time.RFC3339Nano into ContainerJSONBase
Signed-off-by: 3sky <3sky@protonmail.com>
2020-10-12 08:51:47 +02:00
0cdb10448a Monitor for client closing stream
Fixes #7946

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-10-09 15:39:29 -07:00
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
2a63795338 Merge pull request #7966 from baude/issue7950
add compatibility endpoint for exporting multiple images
2020-10-08 18:11:59 -04:00
1b90cb95c5 Merge pull request #7952 from baude/issue7934
APIv2 compatibility rootless network fix
2020-10-08 16:41:21 -04:00
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
0e1d01103e Merge pull request #7382 from mheon/pod_parallel
Move pod jobs to parallel execution
2020-10-07 15:06:02 -04:00
9c4611f166 APIv2 compatibility rootless network fix
when using the compatibility mode as rootless, containers that were created were not setting their host names correctly due to the netmode not being set.

Fixes: #7934

Signed-off-by: baude <bbaude@redhat.com>
2020-10-07 13:34:49 -05:00
fe3faa517e prevent unpredictable results with network create|remove
due to a lack of "locking" on cni operations, we could get ourselves in trouble when doing rapid creation or removal of networks.  added a simple file lock to deal with the collision and because it is not considered a performent path, use of the file lock should be ok.  if proven otherwise in the future, some generic shared memory lock should be implemented for libpod and also used here.

moved pkog/network to libpod/network because libpod is now being pulled into the package and it has therefore lost its generic nature. this will make it easier to absorb into libpod as we try to make the network closer to core operations.

Fixes: #7807

Signed-off-by: baude <bbaude@redhat.com>
2020-10-07 10:03:21 -05:00
2bb2425704 Move pod jobs to parallel execution
Make Podman pod operations that do not involve starting
containers (which needs to be done in a specific order) use the
same parallel operation code we use to make `podman stop` on
large numbers of containers fast. We were previously stopping
containers in a pod serially, which could take up to the timeout
(default 15 seconds) for each container - stopping 100 containers
that do not respond to SIGTERM would take 25 minutes.

To do this, refactor the parallel operation code a bit to remove
its dependency on libpod (damn circular import restrictions...)
and use parallel functions that just re-use the standard
container API operations - maximizes code reuse (previously each
pod handler had a separate implementation of the container
function it performed).

This is a bit of a palate cleanser after fighting CI for two
days - nice to be able to return to a land of sanity.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-10-07 10:00:11 -04:00
defb754945 Merge pull request #7918 from zhangguanzhang/apiv2-wrong-StopSignal
[apiv2] /containers/$name/json return wrong value in `.Config.StopSignal`
2020-10-06 13:17:15 +02:00
80a2317ca2 Merge pull request #7929 from kolyshkin/nits-err
Nits
2020-10-06 10:15:04 +02:00
adde67c74f fix apiv2 /containers/$name/json return wrong value in .Config.StopSignal
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-10-06 11:15:25 +08:00
684d0079d2 Lowercase some errors
This commit is courtesy of

```
for f in $(git ls-files *.go | grep -v ^vendor/); do \
	sed -i 's/\(errors\..*\)"Error /\1"error /' $f;
done

for f in $(git ls-files *.go | grep -v ^vendor/); do \
	sed -i 's/\(errors\..*\)"Failed to /\1"failed to /' $f;
done

```

etc.

Self-reviewed using `git diff --word-diff`, found no issues.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-10-05 15:56:44 -07:00
2fc50f8b13 Fixes remote attach and exec to signal IdleTracker
- Fixes issue where remote attach and exec only signaled the IdleTracker
   on errors. Needs to done anytime after connection has been hijacked
 - Fixes trying to send multiple http status codes to client
 - Changes pprof and API server shutdowns to run in parallel
 - Changes shutdown to run in sync.Once block

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-10-05 10:40:23 -07:00
6a291942c2 compat: images/create: fix tag parsing
The `tag` parameter of the compat `images/create` endpoint can be both,
a tag and a digest.  Fix parsing of the parameter to detect digests and
use the appropriate `@` separator.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-10-02 17:24:37 +02:00
00c7b493a0 Merge pull request #7815 from jwhonce/wip/creds_remote
Add X-Registry-Config support
2020-10-02 06:13:25 -04:00
5d22eb02f9 Merge pull request #7735 from QiWang19/manifest-inspect
fix allowing inspect manifest of non-local image
2020-10-01 13:32:02 -04:00
3948cb76e2 Merge pull request #7851 from zhangguanzhang/fix-apiv2-ctr-workdir-and-env
[apiv2] don't ignore the ENV and WorkDir from the image
2020-10-01 10:00:15 -04:00
fad55e4730 Support --http-proxy for remote builds
* Fix misspelled parameter
 * add http-proxy support for builds

http_proxy must be set in the podman.service unit file, for example
Environment=http_proxy=<value>

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-30 15:56:58 -07:00
cde367c1c0 fix: The container created by APIV2 has an incorrect Env and WorkDir
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-10-01 05:13:01 +08:00
7ac8000cc1 fix allowing inspect manifest of non-local image
Add support of `podman manifest inspect` returning manifest list of non-local manifest.
Close #https://github.com/containers/podman/issues/7726

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-09-30 14:12:32 -04:00
fb43e8c6a4 Merge pull request #7833 from jwhonce/issues/7826
Refactor IdleTracker to handle StateIdle transitions
2020-09-30 14:37:31 +00:00
4d57313449 Merge pull request #7840 from vrothberg/remote-untag
fix remote untag
2020-09-30 12:58:08 +00:00
1a3e409412 fix remote untag
Fix the remote client to untag all tags of the specified image.
Instead of querying the image on the client side, support the
case where both, repo and tag, are empty and remove all tags.

Reuse the ABI implementation where possible.  In retrospective,
the libpod untag endpoint should support a slice of strings to
batch remove tags rather than reaching out for each tag individually.

Enable the skipped test.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-30 11:57:31 +02:00
22474095ab Fix handling of remove of bogus volumes, networks and Pods
In podman containers rm and podman images rm, the commands
exit with error code 1 if the object does not exists.

This PR implements similar functionality to volumes, networks, and Pods.

Similarly if volumes or Networks are in use by other containers, and return
exit code 2.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-29 15:52:43 -04:00
f03d470349 Refactor IdleTracker to handle StateIdle transitions
* Remove stutter naming for package and types
* Stop treating StateIdle the same as StateClosed, rather transitions to
  StateIdle will keep API timeout window open
* Remove redundate code

Fixes #7826

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-29 11:32:47 -07:00
5aead1509c Add X-Registry-Config support
* Refactor auth pkg to support X-Registry-Config
* Refactor build endpoint to support X-Registry-Config. Supports:
  * --creds
  * --authfile
* Added X-Reference-Id Header to http.Request to support log event
  correlation
* Log headers from http.Request

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-29 08:46:44 -07:00
be88d45f5a fix for compatibility volume creation
in the compatibility layer, creating a volume with a name that already does not result in an error.  instead a 201 response with the existing volume's information is returned. while it seems like a bug on the part of docker and they agree, no attempt has been made to fix it in five years.  See https://github.com/moby/moby/issues/16068

Fixes: #7740

Signed-off-by: baude <bbaude@redhat.com>
2020-09-28 13:28:07 -05:00
1b5853e647 Properly handle podman run --pull command
Currently the --pull missing|always|never is ignored

This PR implements this for local API.  For remote we
need to default to pullpolicy specified in the containers.conf
file.

Also fixed an issue when images were matching other images names
based on prefix, causing images to always be pulled.

I had named an image myfedora and when ever I pulled fedora, the system
thought that it there were two images named fedora since it was checking
for the name fedora as well as the prefix fedora.  I changed it to check
for fedora and the prefix /fedora, to prefent failures like I had.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-27 07:25:28 -04:00
684cde87fa Merge pull request #7662 from jwhonce/issues/7535
Evict containers before removing via V2 API
2020-09-24 17:04:03 +00:00
3957058f29 Merge pull request #7753 from vrothberg/fix-7689
remote stats
2020-09-24 15:32:36 +00:00
19b955f099 stats: break out CLI options
Have a clear separation of concerns for the CLI-only options (and their
logic) from the backend.  The backend logic is now easier to understand
(e.g., `stream` instead of `noStream`).

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-24 14:28:10 +02:00
762b787fbf new endpoint: /libpod/containers/stats
Add a new endpoint for container stats allowing for batch operations on
more than one container.  The new endpoint deprecates the
single-container endpoint which will eventually be removed with the next
major release.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-24 14:09:55 +02:00
9765619787 Merge pull request #7761 from baude/interactive
set interactive mode with compat create endpoint
2020-09-24 09:46:46 +00:00
873989f7a4 apiv2 container limit differ from docker-api
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-09-24 08:54:46 +08:00
139100a1f4 set interactive mode with compat create endpoint
when creating a container using the compat endpoint, the interactive bool was being hard set to false and ignoring the user's input.

Signed-off-by: baude <bbaude@redhat.com>
2020-09-23 15:44:23 -05:00
4c48c71729 Merge pull request #7712 from baude/killreturn
add missing return for compat kill
2020-09-22 21:04:37 +00:00
cd65f133d5 add missing return for compat kill
on an error condition in kill for the compatibility layer, we were missing a return.

Signed-off-by: baude <bbaude@redhat.com>
2020-09-21 12:31:07 -05:00
e06230c9d5 Restore 'id' stanza in pull results
id is the last image id from the set of id's returned via the images
stanza.

id may be deprecated in a future version of the API

Created test_rest_v2_0_0.py to reflect the bump in the API Version.

Fixes #7686

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-21 08:51:52 -07:00
051912c8e6 Merge pull request #7688 from vrothberg/fix-7521
remote stats fixes
2020-09-21 10:33:01 -04:00
3fdb83a2ee stats: log errors instead of sending 500
As 200 is already out the door, we cannot send 500s anymore.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-21 09:46:17 +02:00