Commit graph

1759 commits

Author SHA1 Message Date
Daniel J Walsh c9ef260710
Document CONTAINERS_CONF/CONTAINERS_STORAGE_CONF Env variables
Also Switch to using CONTAINERS_REGISTRIES_CONF for registries.conf
overrides.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-10 06:34:47 -05:00
Valentin Rothberg 2abfef3809 podman cp: ignore EPERMs in rootless mode
Ignore permission errors when copying from a rootless container.
TTY devices inside rootless containers are owned by the host's
root user which is "nobody" inside the container's user namespace
rendering us unable to even read them.

Enable the integration test which was temporarily disabled for rootless
users.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-03-09 09:02:14 +01:00
Daniel J Walsh 0e36e65eaa
Allow users to generate a kubernetes yaml off non running containers
Currently if you attempt to create a kube.yaml file off of a non running
container where the container runs as a specific User, the creation
fails because the storage container is not mounted. Podman is supposed to
read the /etc/passwd entry inside of the container but since the
container is not mounted, the c.State.Mountpoint == "".  Podman
incorrectly attempts to read /etc/passwd on the host, and fails if the
specified user is not in the hosts /etc/passwd.

This PR mounts the storage container, if it was not mounted so the read
succeeds.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-08 06:14:08 -05: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 0bac30d724
Merge pull request #9622 from jmguzik/network-rm-fix
Fix podman network rm (-f) workflow
2021-03-05 09:50:03 -05:00
Jakub Guzik 2bcc95257f Fix for podman network rm (-f) workflow
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-05 13:16:37 +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
OpenShift Merge Robot a26b15265e
Merge pull request #9598 from rhatdan/kvm
Check for supportsKVM based on basename of the runtime
2021-03-04 14:54:53 -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
Paul Holzinger aa0a57f095 Fix cni teardown errors
Make sure to pass the cni interface descriptions to cni teardowns.
Otherwise cni cannot find the correct cache files because the
interface name might not match the networks. This can only happen
when network disconnect was used.

Fixes #9602

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-03-04 11:43:59 +01:00
Daniel J Walsh 252aec1c9a
Check for supportsKVM based on basename of the runtime
Fixes: https://github.com/containers/podman/issues/9582

This PR also adds tests to make sure SELinux labels match the runtime,
or if init is specified works with the correct label.

Add tests for selinux kvm/init labels

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-03 16:49:51 -05:00
OpenShift Merge Robot 87e20560ac
Merge pull request #9536 from jmguzik/enable-cgroupsv2-sec-opts
Enable cgroupsv2 rw mount via security-opt unmask
2021-03-03 12:28:54 -05:00
OpenShift Merge Robot 5fd8a84949
Merge pull request #9575 from mheon/rewrite_rename
Rewrite Rename backend in a more atomic fashion
2021-03-03 09:16:19 -05:00
Daniel J Walsh aed632cb8c
Merge pull request #9580 from rhatdan/timestamp
Fix support for podman build --timestamp
2021-03-03 05:08:13 -05:00
Ashley Cui b19791c0b6 Tidy duplicate log tests
Some log tests were duplicated, and some didn't need to be repeated for
every driver. Also, added some comments

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-03-02 14:28:16 -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
Matthew Heon 43e899c2ec Rewrite Rename backend in a more atomic fashion
Move the core of renaming logic into the DB. This guarantees a
lot more atomicity than we have right now (our current solution,
removing the container from the DB and re-creating it, is *VERY*
not atomic and prone to leaving a corrupted state behind if
things go wrong. Moving things into the DB allows us to remove
most, but not all, of this - there's still a potential scenario
where the c/storage rename fails but the Podman rename succeeds,
and we end up with a mismatched state.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-03-02 13:30:28 -05:00
Jakub Guzik d9cb135b64 Enable cgroupsv2 rw mount via security-opt unmask
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-02-28 15:59:43 +01:00
Daniel J Walsh 680dacaea2
Enable no_hosts from containers.conf
Since we have no good way to enable this on the server side, we will
just allow it to be set on the client side. This should solve almost all
cases.

Partially fixes: https://github.com/containers/podman/issues/9500

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-26 06:37:48 -05:00
OpenShift Merge Robot 9ec8106841
Merge pull request #9487 from giuseppe/split-test-named-hierarchies
test: ignore named hierarchies for cgroups=split
2021-02-25 13:36:53 +01:00
Parker Van Roy ef549235eb Updated based on Jhonce comments
Added ID to default
removed outdated imports
slight refactor
Test Network Headers added to network_test.go

Signed-off-by: Parker Van Roy <pvanroy@redhat.com>
2021-02-24 14:52:19 -05:00
OpenShift Merge Robot dec06b1c3f
Merge pull request #9494 from mheon/sort_caps
Sort CapDrop in inspect to guarantee order
2021-02-24 09:27:24 -05:00
Paul Holzinger 90050671b7 Add dns search domains from cni response to resolv.conf
This fixes slow local host name lookups.
see containers/dnsname#57

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-24 10:41:56 +01:00
Paul Holzinger f152f9cf09 Network connect error if net mode is not bridge
Only the the network mode bridge supports cni networks.
Other network modes cannot use network connect/disconnect
so we should throw a error.

Fixes #9496

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-23 22:30:04 +01:00
Matthew Heon fc32ec768d Sort CapDrop in inspect to guarantee order
The order of CapAdd when inspecting containers is deterministic.
However, the order of CapDrop is not (for unclear reasons). Add a
quick sort on the final array to guarantee a consistent order.

Fixes #9490

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-02-23 14:05:18 -05:00
Giuseppe Scrivano 3947feb4b0
test: ignore named hierarchies for cgroups=split
ignore named hierarchies for the --cgroups=split test as crun does not
set it.

Closes: https://github.com/containers/podman/pull/9302#issuecomment-784157272

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-02-23 14:09:17 +01:00
Eduardo Vega 874f2327e6 Add U volume flag to chown source volumes
Signed-off-by: Eduardo Vega <edvegavalerio@gmail.com>
2021-02-22 22:55:19 -06:00
OpenShift Merge Robot d999328920
Merge pull request #9455 from Luap99/fix-network-ids
Fix podman network IDs handling
2021-02-22 16:56:43 -05: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
Paul Holzinger 9d818be732 Fix podman network IDs handling
The libpod network logic knows about networks IDs but OCICNI
does not. We cannot pass the network ID to OCICNI. Instead we
need to make sure we only use network names internally. This
is also important for libpod since we also only store the
network names in the state. If we would add a ID there the
same networks could accidentally be added twice.

Fixes #9451

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-22 15:51:49 +01:00
OpenShift Merge Robot 6fbf73ed8b
Merge pull request #9420 from rhatdan/kube
[NO TESTS NEEDED] Allow podman play kube to read yaml file from stdin
2021-02-22 09:08:33 -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
OpenShift Merge Robot d92b94677c
Merge pull request #9448 from vrothberg/bump-module-version
bump go module to v3
2021-02-22 05:51:31 -05:00
Jakub Guzik c236aebb9b Two variations of --new flag added to e2e
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-02-22 09:53:42 +01: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
OpenShift Merge Robot 7b52654649
Merge pull request #9417 from ashley-cui/journald
Fix journald logs
2021-02-21 05:03:46 -05:00
Daniel J Walsh 05eb06f568 Turn on journald and k8s file logging tests
Signed-off-by: Ashley Cui <acui@redhat.com>
2021-02-19 16:11:41 -05:00
Daniel J Walsh f06dd45e0c
Allow podman play kube to read yaml file from stdin
Fixes: https://github.com/containers/podman/issues/8996

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-19 12:53:25 -05:00
baude d6b0b54121 Fix segfault in run with memory-swap
when unlimited (-1) was being passed to memory-swap, podman threw a
segfault.

Fixes #9429

Signed-off-by: baude <bbaude@redhat.com>
2021-02-19 07:56:14 -06:00
Matthew Heon a9d548bf77 Change source path resolution for volume copy-up
Instead of using the container's mountpoint as the base of the
chroot and indexing from there by the volume directory, instead
use the full path of what we want to copy as the base of the
chroot and copy everything in it. This resolves the bug, ends up
being a bit simpler code-wise (no string concatenation, as we
already have the full path calculated for other checks), and
seems more understandable than trying to resolve things on the
destination side of the copy-up.

Fixes #9354

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-02-17 14:57:06 -05:00
OpenShift Merge Robot d48f4a0e1f
Merge pull request #9383 from mheon/fix_copyup_empty
Fix an issue where copyup could fail with ENOENT
2021-02-17 13:18:33 -05:00
OpenShift Merge Robot 516dc6d1ff
Merge pull request #9409 from rhatdan/size
podman ps --format '{{ .Size }}' requires --size option
2021-02-17 11:10:33 -05:00
Daniel J Walsh e2d5a1d051
podman ps --format '{{ .Size }}' requires --size option
Podman -s crashes when the user specifies the '{{ .Size }}` format
on the podman ps command, without specifying the --size option.

This PR will stop the crash and print out a logrus.Error stating that
the caller should add the --size option.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-17 07:55:12 -05:00
Daniel J Walsh 12a577aea5
Ignore entrypoint=[\"\"]
We recieved an issue with an image that was built with
entrypoint=[""]
This blows up on Podman, but works on Docker.

When we setup the OCI Runtime, we should drop
entrypoint if it is == [""]

https://github.com/containers/podman/issues/9377

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-17 07:00:53 -05:00
OpenShift Merge Robot 50042120e9
Merge pull request #9240 from rhatdan/reset
Do not reset storage when running inside of a container
2021-02-16 17:11:26 -05:00
Daniel J Walsh 5d1ec2960d
Do not reset storage when running inside of a container
Currently if the host shares container storage with a container
running podman, the podman inside of the container resets the
storage on the host. This can cause issues on the host, as
well as causes the podman command running the container, to
fail to unmount /dev/shm.

podman run -ti --rm --privileged -v /var/lib/containers:/var/lib/containers quay.io/podman/stable podman run alpine echo hello
	* unlinkat /var/lib/containers/storage/overlay-containers/a7f3c9deb0656f8de1d107e7ddff2d3c3c279c11c1635f233a0bffb16051fb2c/userdata/shm: device or resource busy
	* unlinkat /var/lib/containers/storage/overlay-containers/a7f3c9deb0656f8de1d107e7ddff2d3c3c279c11c1635f233a0bffb16051fb2c/userdata/shm: device or resource busy

Since podman is volume mounting in the graphroot, it will add a flag to
/run/.containerenv to tell podman inside of container whether to reset storage or not.

Since the inner podman is running inside of the container, no reason to assume this is a fresh reboot, so if "container" environment variable is set then skip
reset of storage.

Also added tests to make sure /run/.containerenv is runnig correctly.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-16 14:18:53 -05:00
Daniel J Walsh 958f901431
podman kill should report rawInput not container id
Docker always reports back the users input, not the full
id, we should do the same.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-16 09:47:38 -05:00
OpenShift Merge Robot 58a4793bec
Merge pull request #9396 from rhatdan/stop
When stopping a container, print rawInput
2021-02-16 09:46:28 -05:00
OpenShift Merge Robot aadb16da38
Merge pull request #9380 from baude/podinfra
Fix panic in pod creation
2021-02-16 09:25:28 -05:00