Commit graph

150 commits

Author SHA1 Message Date
OpenShift Merge Robot 5432bb95f1
Merge pull request #12174 from fgimenez/fix-docker-networksettings-type-discrepancy
Introduces Address type to be used in secondary IPv4 and IPv6 inspect data structure
2021-11-19 13:57:13 +01:00
Paul Holzinger 0dae50f1d3
Do not store the exit command in container config
There is a problem with creating and storing the exit command when the
container was created. It only contains the options the container was
created with but NOT the options the container is started with. One
example would be a CNI network config. If I start a container once, then
change the cni config dir with `--cni-config-dir` ans start it a second
time it will start successfully. However the exit command still contains
the wrong `--cni-config-dir` because it was not updated.

To fix this we do not want to store the exit command at all. Instead we
create it every time the conmon process for the container is startet.
This guarantees us that the container cleanup process is startet with
the correct settings.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-11-18 20:28:03 +01:00
Federico Gimenez 2e5d3e8fb3 Introduce Address type to be used in secondary IPv4 and IPv6 inspect data
structure.

Resolves a discrepancy between the types used in inspect for docker and podman.
This causes a panic when using the docker client against podman when the
secondary IP fields in the `NetworkSettings` inspect field are populated.

Fixes containers#12165

Signed-off-by: Federico Gimenez <fgimenez@redhat.com>
2021-11-18 17:04:49 +01:00
Adrian Reber 6202e8102b
Added optional container checkpointing statistics
This adds the parameter '--print-stats' to 'podman container checkpoint'.
With '--print-stats' Podman will measure how long Podman itself, the OCI
runtime and CRIU requires to create a checkpoint and print out these
information. CRIU already creates checkpointing statistics which are
just read in addition to the added measurements. In contrast to just
printing out the ID of the checkpointed container, Podman will now print
out JSON:

 # podman container checkpoint --latest --print-stats
 {
     "podman_checkpoint_duration": 360749,
     "container_statistics": [
         {
             "Id": "25244244bf2efbef30fb6857ddea8cb2e5489f07eb6659e20dda117f0c466808",
             "runtime_checkpoint_duration": 177222,
             "criu_statistics": {
                 "freezing_time": 100657,
                 "frozen_time": 60700,
                 "memdump_time": 8162,
                 "memwrite_time": 4224,
                 "pages_scanned": 20561,
                 "pages_written": 2129
             }
         }
     ]
 }

The output contains 'podman_checkpoint_duration' which contains the
number of microseconds Podman required to create the checkpoint. The
output also includes 'runtime_checkpoint_duration' which is the time
the runtime needed to checkpoint that specific container. Each container
also includes 'criu_statistics' which displays the timing information
collected by CRIU.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-11-15 11:50:24 +00:00
Paul Holzinger 8041d44c93
Add network backend to podman info
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-11-11 16:49:46 +01:00
cdoern 6da97c8631 Pod Volumes From Support
added support for a volumes from container. this flag just required movement of the volumes-from flag declaration
out of the !IsInfra block, and minor modificaions to container_create.go

Signed-off-by: cdoern <cdoern@redhat.com>
2021-10-01 14:09:11 -04:00
OpenShift Merge Robot 81aabc8054
Merge pull request #11686 from cdoern/podDeviceOptions
Pod Device-Read-BPS support
2021-10-01 10:53:14 -04:00
Brent Baude 1ff6a5082a Support selinux options with bind mounts play/gen
When using play kube and generate kube, we need to support if bind
mounts have selinux options.  As kubernetes does not support selinux in
this way, we tuck the selinux values into a pod annotation for
generation of the kube yaml.  Then on play, we check annotations to see
if a value for the mount exists and apply it.

Fixes BZ #1984081

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-09-30 10:49:14 -05:00
cdoern 2d86051893 Pod Device-Read-BPS support
added the option for the user to specify a rate, in bytes, at which they would like to be able
to read from the device being added to the pod. This is the first in a line of pod device options.

WARNING: changed pod name json tag to pod_name to avoid confusion when marshaling with the containerspec's name

Signed-off-by: cdoern <cdoern@redhat.com>
2021-09-28 21:20:01 -04:00
Giuseppe Scrivano 3ce98a5ec2
logging: new mode -l passthrough
it allows to pass the current std streams down to the container.

conmon support: https://github.com/containers/conmon/pull/289

[NO TESTS NEEDED] it needs a new conmon.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-09-27 12:07:01 +02:00
Paul Holzinger 1199733754
podman inspect add State.Health field for docker compat
podman inspect shows the healthcheck status in `.State.Healthcheck`,
docker uses `.State.Health`. To make sure docker scripts work we
should add the `Health` key. Because we do not want to display both keys
by default we only use the new `Health` key. This is a breaking change
for podman users but matches what docker does. To provide some form of
compatibility users can still use `--format {{.State.Healthcheck}}`. IT
is just not shown by default.

Fixes #11645

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-23 14:44:34 +02:00
cdoern 8fac34b8ff Pod Device Support
added support for pod devices. The device gets added to the infra container and
recreated in all containers that join the pod.

This required a new container config item to keep track of the original device passed in by the user before
the path was parsed into the container device.

Signed-off-by: cdoern <cdoern@redhat.com>
2021-09-20 23:22:43 -04:00
Daniel J Walsh 3e77f960f6
Set default storage from containers.conf for temporary images
Fixes: https://github.com/containers/podman/issues/11107

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-15 10:43:51 -04:00
OpenShift Merge Robot 4b6ffda31c
Merge pull request #11409 from cdoern/podVolumes
Pod Volumes Support
2021-09-15 09:10:12 -04:00
Anders F Björklund 38c5f6721f Show variant and codename of the distribution
Along with the name (id) and the version(_id)

But only show the information if is available

Examples: Fedora CoreOS, Ubuntu Focal

[NO TESTS NEEDED]

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2021-09-14 17:44:42 +02:00
cdoern 84005330aa Pod Volumes Support
added support for the --volume flag in pods using the new infra container design.
users can specify all volume options they can with regular containers

resolves #10379

Signed-off-by: cdoern <cdoern@redhat.com>
2021-09-14 08:32:07 -04:00
Daniel J Walsh 2f967b81cb
Add logDriver to podman info
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-08 17:53:04 -04:00
Matthew Heon bfcd83ecd6 Add Checkpointed bool to Inspect
When inspecting a container, we now report whether the container
was stopped by a `podman checkpoint` operation via a new bool in
the State portion of inspected, `Checkpointed`.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-09-07 14:16:01 -04:00
Paul Holzinger 16dfce486b
Podman info output plugin information
For docker compat include information about available volume, log and
network drivers which should be listed under the plugins key.

Fixes #11265

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-08-19 17:33:20 +02:00
Brent Baude bef26f2582 rename oneshot initcontainers to once
after the init containers pr merged, it was suggested to use `once`
instead of `oneshot` containers as it is more aligned with other
terminiology used similarily.

[NO TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-08-12 12:57:15 -05:00
Daniel J Walsh 221b1add74 Add support for pod inside of user namespace.
Add the --userns flag to podman pod create and keep
track of the userns setting that pod was created with
so that all containers created within the pod will inherit
that userns setting.

Specifically we need to be able to launch a pod with
--userns=keep-id

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2021-08-09 15:17:22 -04:00
Brent Baude 3c3fa6fac4 implement init containers in podman
this is the first pass at implementing init containers for podman pods.
init containersare made popular by k8s as a way to run setup for pods
before the pods standard containers run.

unlike k8s, we support two styles of init containers: always and
oneshot.  always means the container stays in the pod and starts
whenever a pod is started.  this does not apply to pods restarting.
oneshot means the container runs onetime when the pod starts and then is
removed.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-08-04 14:14:36 -05:00
cdoern f7321681d0 podman pod create --pid flag
added support for --pid flag. User can specify ns:file, pod, private, or host.
container returns an error since you cannot point the ns of the pods infra container
to a container outside of the pod.

Signed-off-by: cdoern <cdoern@redhat.com>
2021-07-15 10:34:09 -04:00
Paul Holzinger 8f6a0243f4
podman diff accept two images or containers
First, make podman diff accept optionally a second argument. This allows
the user to specify a second image/container to compare the first with.
If it is not set the parent layer will be used as before.

Second, podman container diff should only use containers and podman
image diff should only use images. Previously, podman container diff
would use the image when both an image and container with this name
exists.

To make this work two new parameters have been added to the api. If they
are not used the previous behaviour is used. The same applies to the
bindings.

Fixes #10649

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-07-02 17:11:56 +02:00
OpenShift Merge Robot 3f3feaa015
Merge pull request #10716 from cdoern/podFlags
Podman Pod Create --cpus and --cpuset-cpus flags
2021-06-23 15:51:29 -04:00
cdoern bbd085ad1e Podman Pod Create --cpus and --cpuset-cpus flags
Added logic and handling for two new Podman pod create Flags.

--cpus specifies the total number of cores on which the pod can execute, this
is a combination of the period and quota for the CPU.

 --cpuset-cpus is a string value which determines of these available cores,
how many we will truly execute on.

Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
2021-06-23 13:47:57 -04:00
cdoern f26fa53921 Podman Stats additional features
added Avg Cpu calculation and CPU up time to podman stats. Adding different feature sets in different PRs, CPU first.

resolves #9258

Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
2021-06-23 09:23:40 -04:00
OpenShift Merge Robot a6f0ac229f
Merge pull request #10436 from rhatdan/errors
Improve OCI Runtime error
2021-05-24 19:17:29 +02:00
flouthoc 2f5552c32d Podman info add support for status of cgroup controllers
Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2021-05-24 16:55:23 +05:30
Daniel J Walsh 4c095aa7e2
Improve OCI Runtime error
ErrOCIRuntimeNotFound error is misleading. Try to make it more
understandable to the user that the OCI Runtime IE crun or runc is not
missing, but the command they attempted to run within the container is
missing.

[NO TESTS NEEDED] Regular tests should handle this.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-05-22 04:58:48 -04:00
OpenShift Merge Robot 9a9118b831
Merge pull request #10366 from ashley-cui/secretoptions
Support uid,gid,mode options for secrets
2021-05-17 16:24:20 -04:00
Ashley Cui cf30f160ad Support uid,gid,mode options for secrets
Support UID, GID, Mode options for mount type secrets. Also, change
default secret permissions to 444 so all users can read secret.

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-05-17 14:35:55 -04:00
Paul Holzinger 4462113c5e podman network reload add rootless support
Allow podman network reload to be run as rootless user. While it is
unlikely that the iptable rules are flushed inside the rootless cni
namespace, it could still happen. Also fix podman network reload --all
to ignore errors when a container does not have the bridge network mode,
e.g. slirp4netns.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-05-17 10:55:02 +02:00
Jhon Honce 8ad40a85d5 Add host.serviceIsRemote to podman info results
Developers asked for a deterministic field to verify if podman is
running via API or linked directly to libpod library.

$ podman info --format '{{.Host.ServiceIsRemote}}'
false
$ podman-remote info --format '{{.Host.ServiceIsRemote}}'
true
$ podman --remote info --format '{{.Host.ServiceIsRemote}}'
true

* docs/conf.py formatted via black

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-05-10 14:13:15 -07:00
Boaz Shuster efdc7d8465 Add restart-policy to container filters & --filter to podman start
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
2021-05-06 14:35:15 +03:00
Daniel J Walsh 0d1ebc180e
codespell cleanup
[NO TESTS NEEDED] This is just running codespell on podman

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-05-05 15:50:59 -04:00
Valentin Rothberg 0f7d54b026 migrate Podman to containers/common/libimage
Migrate the Podman code base over to `common/libimage` which replaces
`libpod/image` and a lot of glue code entirely.

Note that I tried to leave bread crumbs for changed tests.

Miscellaneous changes:

 * Some errors yield different messages which required to alter some
   tests.

 * I fixed some pre-existing issues in the code.  Others were marked as
   `//TODO`s to prevent the PR from exploding.

 * The `NamesHistory` of an image is returned as is from the storage.
   Previously, we did some filtering which I think is undesirable.
   Instead we should return the data as stored in the storage.

 * Touched handlers use the ABI interfaces where possible.

 * Local image resolution: previously Podman would match "foo" on
   "myfoo".  This behaviour has been changed and Podman will now
   only match on repository boundaries such that "foo" would match
   "my/foo" but not "myfoo".  I consider the old behaviour to be a
   bug, at the very least an exotic corner case.

 * Futhermore, "foo:none" does *not* resolve to a local image "foo"
   without tag anymore.  It's a hill I am (almost) willing to die on.

 * `image prune` prints the IDs of pruned images.  Previously, in some
   cases, the names were printed instead.  The API clearly states ID,
   so we should stick to it.

 * Compat endpoint image removal with _force_ deletes the entire not
   only the specified tag.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-05 11:30:12 +02:00
Pablo Correa Gómez 18cb17ffeb
Use seccomp_profile as default profile if defined in containers.conf
Edits `podman info` to provide the default seccomp profile
detected in the output

Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
2021-04-28 15:19:48 +02:00
Daniel J Walsh 3538815c5b
Add podman run --timeout option
This option allows users to specify the maximum amount of time to run
before conmon sends the kill signal to the container.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-23 11:18:05 -04:00
Daniel J Walsh 9c8277247d
Fixes from make codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-21 13:16:33 -04:00
OpenShift Merge Robot 41677b192a
Merge pull request #8979 from haircommander/full-attach-path
Use full attach path, rather than a symlink
2021-04-21 05:25:19 -04:00
chenkang a1002beb78
fix start it
Signed-off-by: chenkang <kongchen28@gmail.com>
2021-04-17 23:35:27 +08:00
chenkang b963a5eb4a
add pidfile in inspection
Signed-off-by: chenkang <kongchen28@gmail.com>
2021-04-17 20:56:08 +08:00
Peter Hunt b2c6663a9f runtime: return findConmon to libpod
I believe moving the conmon probing code to c/common wasn't the best strategy.
Different container engines have different requrements of which conmon version is required
(based on what flags they use).

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2021-04-16 17:45:52 -04:00
Matthew Heon 6acd265306 Add --requires flag to podman run/create
Podman has, for a long time, had an internal concept of
dependency management, used mainly to ensure that pod infra
containers are started before any other container in the pod. We
also have the ability to recursively start these dependencies,
which we use to ensure that `podman start` on a container in a
pod will not fail because the infra container is stopped. We have
not, however, exposed these via the command line until now.

Add a `--requires` flag to `podman run` and `podman create` to
allow users to manually specify dependency containers. These
containers must be running before the container will start. Also,
make recursive starting with `podman start` default so we can
start these containers and their dependencies easily.

Fixes #9250

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-04-06 14:01:31 -04:00
Paul Holzinger 57e8c66322 Do not leak libpod package into the remote client
Some packages used by the remote client imported the libpod package.
This is not wanted because it adds unnecessary bloat to the client and
also causes problems with platform specific code(linux only), see #9710.

The solution is to move the used functions/variables into extra packages
which do not import libpod.

This change shrinks the remote client size more than 6MB compared to the
current master.

[NO TESTS NEEDED]
I have no idea how to test this properly but with #9710 the cross
compile should fail.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-03-15 14:02:04 +01:00
Jakub Guzik e4da5096ba separate file with mount consts in libpod/define
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-07 12:01:04 +01:00
OpenShift Merge Robot 05080a12a9
Merge pull request #9593 from vrothberg/cp-tmp
podman cp: support copying on tmpfs mounts
2021-03-05 03:57:17 -05:00
Valentin Rothberg a090301bbb podman cp: support copying on tmpfs mounts
Traditionally, the path resolution for containers has been resolved on
the *host*; relative to the container's mount point or relative to
specified bind mounts or volumes.

While this works nicely for non-running containers, it poses a problem
for running ones.  In that case, certain kinds of mounts (e.g., tmpfs)
will not resolve correctly.  A tmpfs is held in memory and hence cannot
be resolved relatively to the container's mount point.  A copy operation
will succeed but the data will not show up inside the container.

To support these kinds of mounts, we need to join the *running*
container's mount namespace (and PID namespace) when copying.

Note that this change implies moving the copy and stat logic into
`libpod` since we need to keep the container locked to avoid race
conditions.  The immediate benefit is that all logic is now inside
`libpod`; the code isn't scattered anymore.

Further note that Docker does not support copying to tmpfs mounts.

Tests have been extended to cover *both* path resolutions for running
and created containers.  New tests have been added to exercise the
tmpfs-mount case.

For the record: Some tests could be improved by using `start -a` instead
of a start-exec sequence.  Unfortunately, `start -a` is flaky in the CI
which forced me to use the more expensive start-exec option.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-03-04 15:43:12 +01: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