Commit graph

605 commits

Author SHA1 Message Date
Valentin Rothberg e611176760 pkg/apparmor: fix when AA is disabled
Do not try to load the default profile when AppArmor is disabled on the
host.

Fixes: #3331
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-06-14 17:37:16 +02:00
Giuseppe Scrivano 23efe4cb81
storage: support --mount type=bind,bind-nonrecursive
add support for not recursive bind mounts.

Closes: https://github.com/containers/libpod/issues/3314

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-06-13 15:32:45 +02:00
Giuseppe Scrivano 97f4818ce1
storage: fix typo
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-06-13 11:29:07 +02:00
OpenShift Merge Robot a89d013b12
Merge pull request #3283 from haircommander/logging-play-kube-hotfix
Set a default log driver if none is specified
2019-06-10 20:19:33 +02:00
Peter Hunt 9313556591 only set log driver if it isn't empty
Now, not setting a log driver in a create config correctly takes the default (k8s-logging)

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-06-08 17:46:17 -04:00
Cameron Nemo 8d2c7c269d
Fix cgo includes for musl
closes #3284

Signed-off-by: Cameron Nemo <cnemo@tutanota.com>
2019-06-08 14:15:03 -07:00
OpenShift Merge Robot 39f5ea4c04
Merge pull request #3180 from mheon/inspect_volumes
Begin to break up pkg/inspect
2019-06-08 14:45:24 +02:00
OpenShift Merge Robot bcc89e9d08
Merge pull request #3271 from giuseppe/rootless-skip-ns-resolution-on-old-kernels
rootless: skip NS_GET_PARENT on old kernels
2019-06-07 15:39:28 +02:00
OpenShift Merge Robot 346128792c
Merge pull request #2272 from adrianreber/migration
Add support to migrate containers
2019-06-07 14:33:20 +02:00
Giuseppe Scrivano 4dca13e704
rootless: skip NS_GET_PARENT on old kernels
on old kernels the ioctl NS_GET_PARENT is not available.

Handle the error code and immediately return the same fd.  It should
be fine now that we use the namespace resolution using the conmon pid,
so the namespace parent resolution is just a safety measure.

Closes: https://github.com/containers/libpod/issues/2968

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-06-06 15:32:45 +02:00
OpenShift Merge Robot 3fb9669a63
Merge pull request #3231 from baude/remoteclientconf
podman-remote.conf enablement
2019-06-04 20:02:01 +02:00
OpenShift Merge Robot 7b0d6fcf0e
Merge pull request #3225 from haraldh/virtwriter
pkg/varlinkapi/virtwriter/virtwriter.go: simplify func Reader
2019-06-04 15:50:48 +02:00
OpenShift Merge Robot db1e422461
Merge pull request #3251 from giuseppe/join-block-signals
rootless: block signals on re-exec
2019-06-04 14:39:39 +02:00
Adrian Reber bef83c42ea
migration: add possibility to restore a container with a new name
The option to restore a container from an external checkpoint archive
(podman container restore -i /tmp/checkpoint.tar.gz) restores a
container with the same name and same ID as id had before checkpointing.

This commit adds the option '--name,-n' to 'podman container restore'.
With this option the restored container gets the name specified after
'--name,-n' and a new ID. This way it is possible to restore one
container multiple times.

If a container is restored with a new name Podman will not try to
request the same IP address for the container as it had during
checkpointing. This implicitly assumes that if a container is restored
from a checkpoint archive with a different name, that it will be
restored multiple times and restoring a container multiple times with
the same IP address will fail as each IP address can only be used once.

Signed-off-by: Adrian Reber <areber@redhat.com>
2019-06-04 14:02:51 +02:00
Adrian Reber 0e072f9a97
Also download container images during restore
If restoring a container from a checkpoint it was necessary that the
image the container is based was already available (podman pull).

This commit adds the image download to podman container restore if it
does not exist.

Signed-off-by: Adrian Reber <areber@redhat.com>
2019-06-03 22:05:13 +02:00
Adrian Reber 0028578b43
Added support to migrate containers
This commit adds an option to the checkpoint command to export a
checkpoint into a tar.gz file as well as importing a checkpoint tar.gz
file during restore. With all checkpoint artifacts in one file it is
possible to easily transfer a checkpoint and thus enabling container
migration in Podman. With the following steps it is possible to migrate
a running container from one system (source) to another (destination).

 Source system:
  * podman container checkpoint -l -e /tmp/checkpoint.tar.gz
  * scp /tmp/checkpoint.tar.gz destination:/tmp

 Destination system:
  * podman pull 'container-image-as-on-source-system'
  * podman container restore -i /tmp/checkpoint.tar.gz

The exported tar.gz file contains the checkpoint image as created by
CRIU and a few additional JSON files describing the state of the
checkpointed container.

Now the container is running on the destination system with the same
state just as during checkpointing. If the container is kept running
on the source system with the checkpoint flag '-R', the result will be
that the same container is running on two different hosts.

Signed-off-by: Adrian Reber <areber@redhat.com>
2019-06-03 22:05:12 +02:00
Matthew Heon 1be345bd9d Begin to break up pkg/inspect
Let's put inspect structs where they're actually being used. We
originally made pkg/inspect to solve circular import issues.
There are no more circular import issues.

Image structs remain for now, I'm focusing on container inspect.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-06-03 15:54:53 -04:00
OpenShift Merge Robot e41162076a
Merge pull request #3081 from baude/remotecommit
podman remote-client commit
2019-06-03 20:58:13 +02:00
Harald Hoyer 939f8150da
pkg/varlinkapi/virtwriter/virtwriter.go: simplify func Reader
Signed-off-by: Harald Hoyer <harald@redhat.com>
2019-06-03 16:31:45 +02:00
Giuseppe Scrivano 6b0e1a3091
rootless: block signals on re-exec
we are allowed to use only signal safe functions between a fork of a
multithreaded application and the next execve.  Since setenv(3) is not
signal safe, block signals.  We are already doing it for creating a
new namespace.

This is mostly a cleanup since reexec_in_user_namespace_wait is used
only only to join existing namespaces when we have not a pause.pid
file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-06-03 14:25:10 +02:00
Giuseppe Scrivano 27e47cb6d0
rootless: use TEMP_FAILURE_RETRY macro
avoid checking for EINTR for every syscall that could block.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-31 22:05:25 +02:00
Giuseppe Scrivano b88dc3a41e
rootless: fix return type
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-31 22:05:25 +02:00
Giuseppe Scrivano 10983c363e
rootless: make sure the buffer is NUL terminated
after we read from the pause PID file, NUL terminate the buffer to
avoid reading garbage from the stack.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-31 22:05:24 +02:00
OpenShift Merge Robot 558ce8d141
Merge pull request #3224 from haraldh/varlink_upgrade
Fix for varlink upgrade connections
2019-05-31 04:53:29 +02:00
OpenShift Merge Robot 88b7a221a2
Merge pull request #3238 from mheon/no_tmpcopyup_dev
Do not set tmpcopyup on /dev
2019-05-31 04:15:31 +02:00
Matthew Heon c520e34ea7 Do not set tmpcopyup on /dev
Fixes #3229

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-30 14:02:14 -04:00
baude 2df462024b podman remote-client commit
add the ability to commit a container to an image using the remote
client.

Signed-off-by: baude <bbaude@redhat.com>
2019-05-30 10:14:23 -05:00
baude dc7ae31171 podman-remote.conf enablement
add the ability for the podman remote client to use a configuration file
which describes its connections. users can now define a connection the
configuration and then call it by name like:

podman-remote -c connection1

and the destination and user will be derived from the configuration
file.  if no -c is provided, we look for a connection in the
configuration file designated as 'default'.  If the configuration file
has only one connection, it will be deemed the 'default'.

Signed-off-by: baude <bbaude@redhat.com>
2019-05-30 09:41:17 -05:00
OpenShift Merge Robot 294448c2ea
Merge pull request #2709 from haircommander/journald
Add libpod journald logging
2019-05-29 17:51:27 +02:00
Harald Hoyer 90ae7206f3 Fix the varlink upgraded calls
Although an upgraded call is requested, the server has to send at least
one reply (can be an error) and the client has to check the reply,
before assuming an upgraded connection.

Signed-off-by: Harald Hoyer <harald@redhat.com>
2019-05-29 17:16:18 +02:00
Peter Hunt f61fa28d39 Added --log-driver and journald logging
Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-05-28 11:10:57 -04:00
Giuseppe Scrivano 153503e391
rootless: make JoinUserAndMountNS private
as it is used only by the rootless package now.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-25 13:48:00 +02:00
Giuseppe Scrivano 30ef6ba125
rootless: enable loginctl linger
otherwise the processes we leave around will be killed once the
session terminates.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-25 13:47:58 +02:00
Giuseppe Scrivano ee11f3bce9
rootless: new function to join existing conmon processes
move the logic for joining existing namespaces down to the rootless
package.  In main_local we still retrieve the list of conmon pid files
and use it from the rootless package.

In addition, create a temporary user namespace for reading these
files, as the unprivileged user might not have enough privileges for
reading the conmon pid file, for example when running with a different
uidmap and root in the container is different than the rootless user.

Closes: https://github.com/containers/libpod/issues/3187

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-25 13:47:57 +02:00
Giuseppe Scrivano ce26aa701f
rootless: block signals for pause
block signals for the pause process, so it can't be killed by
mistake.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-25 13:46:32 +02:00
Giuseppe Scrivano f09370c68b
userns: add new option --userns=keep-id
it creates a namespace where the current UID:GID on the host is mapped
to the same UID:GID in the container.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-24 17:34:12 +02:00
Giuseppe Scrivano 6df320c391
rootless: store also the original GID in the host
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-23 22:41:48 +02:00
OpenShift Merge Robot e0376b9c3f
Merge pull request #3108 from rhatdan/flags
Fixup Flags
2019-05-22 16:27:30 +02:00
OpenShift Merge Robot 6f02f3b2bc
Merge pull request #3176 from baude/resizechanbuffer
make remote resize channel buffered
2019-05-22 08:57:53 +02:00
OpenShift Merge Robot 488b698040
Merge pull request #3177 from mheon/duplicate_volumes
When superceding mounts, check for opposite types
2019-05-22 00:10:40 +02:00
OpenShift Merge Robot 536fd6addd
Merge pull request #3084 from giuseppe/rootless-pause-process
rootless: use a pause process to keep namespaces alive
2019-05-21 22:08:08 +02:00
Matthew Heon cec56b0075
Merge pull request #3168 from rhatdan/vendor
Update vendor of buildah and containers/images
2019-05-21 15:54:26 -04:00
Matthew Heon 57e38e9550 When superceding mounts, check for opposite types
When we supercede low-priority mounts and volumes (image volumes,
and volumes sourced from --volumes-from) with higher-priority
ones (the --volume and --mount flags), we always replaced
lower-priority mounts of the same type (e.g. a user mount to
/tmp/test1 would supercede a volumes-from mount to the same
destination). However, we did not supercede the opposite type - a
named volume from image volumes at /tmp/test1 would be allowed to
remain and create a conflict, preventing container creation.

Solve this by destroying opposite types before merging (we can't
do it in the same loop, as then named volumes, which go second,
might trample changes made by mounts).

Fixes #3174

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-21 10:21:21 -04:00
baude 00262edf6c make remote resize channel buffered
when doing any sort of attach to a container, a sigwinch is sent
followed by a resize event.  this is fine for the local client but when
doing things over the varlink, the first sigwinch is wiped out by the
immediate resize event and is therefore lost.  by making the channel
buffered, both events are processed after the varlink connection is
established.

Signed-off-by: baude <bbaude@redhat.com>
2019-05-21 09:13:19 -05:00
Giuseppe Scrivano 14fe39968f
rootless: force resources to be nil on cgroup v1
force the resources block to be empty instead of having default
values.

Regression introduced by 8e88461511

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-20 21:45:05 +02:00
Daniel J Walsh baed81029b
Fixup Flags
Mark hidden all references to signature-policy
Default all uses of --authfile
Add --authfile support to podman run and podman create.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-05-20 13:53:32 -04:00
Daniel J Walsh 1d505f6875
Update vendor of buildah and containers/images
Mainly add support for podman build using --overlay mounts.

Updates containers/image also adds better support for new registries.conf
file.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-05-20 13:39:40 -04:00
OpenShift Merge Robot 8d5432932d
Merge pull request #3139 from jwhonce/wip/remote_info
Add connection information to podman-remote info
2019-05-20 17:20:59 +02:00
Daniel J Walsh db218e7162
Don't set apparmor if --priviliged
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-05-20 09:11:16 -04:00
OpenShift Merge Robot 00ecbfc131
Merge pull request #2844 from haircommander/cri-o-update
move to cri-o/cri-o and build with containers/conmon
2019-05-17 21:49:10 +02:00