Commit graph

484 commits

Author SHA1 Message Date
Jhon Honce 4d13a80fa4 Support podman-remote stop container(s)
* Clean up adapter code
* Add GetContainersByContext to Varlink API
* Add missing comments
* Restore save command
* Restore error type mapping when using varlink

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-03-02 08:57:20 -07:00
Giuseppe Scrivano 0b34327ad4
exec: support --preserve-fds
Allow to pass additional FDs to the process being executed.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-02 11:45:42 +01:00
Giuseppe Scrivano 23615099e9
rootless, new[ug]idmap: on failure add output
if any of the mapping tools for setting up the user namespace fail,
then include their output in the error message.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-28 16:16:48 +01:00
Giuseppe Scrivano 80bad464f9
secrets: fix fips-mode with user namespaces
When using a user namespace, we create the mount point under
`mountPrefix` so that the uid != 0 can access that directory.

Change the addFIPSModeSecret code to honor that, and also ensure we
are creating the directories with the right ownership.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-27 22:40:38 +01:00
Matthew Heon ffefbda694 Fix build for non-Varlink-tagged Podman
Fixes #2459

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-27 10:27:08 -05:00
Matthew Heon f68a243f8e Centralize setting default volume path
No reason to do it in util/ anymore. It's always going to be a
subdirectory of c/storage graph root by default, so we can just
set it after the return.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-26 15:44:46 -05:00
Matthew Heon 5511cdc487 Ensure volume path is set appropriately by default
There are some cases where we might not be properly adjusting the
volume path after setting the storage graph root. Ensure that we
always set volume path to be a child of graph root.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-26 15:39:13 -05:00
Giuseppe Scrivano 21bc766ee3
volume: do not create a volume if there is a bind
if there is already a bind mount specified for the target, do not
create a new volume.

Regression introduced by 52df1fa7e0

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-26 18:42:04 +01:00
baude 0416b3afc4 podman-remote pod pause|unpause|restart
enable the ability for the remote client to pause, unpause, and
restart pods.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-25 16:14:06 -06:00
OpenShift Merge Robot cf521449e5
Merge pull request #2422 from baude/remotepodcreate
podman-remote create|ps
2019-02-25 21:57:42 +01:00
OpenShift Merge Robot e45c442080
Merge pull request #2358 from rhatdan/namespace
Fix up handling of user defined network namespaces
2019-02-25 21:31:50 +01:00
Giuseppe Scrivano 0f5ae3c5af
podman: fix ro bind mounts if no* opts are on the source
This is a workaround for the runc issue:

https://github.com/opencontainers/runc/issues/1247

If the source of a bind mount has any of nosuid, noexec or nodev, be
sure to propagate them to the bind mount so that when runc tries to
remount using MS_RDONLY, these options are also used.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-25 18:56:09 +01:00
baude 43a1686598 podman-remote create|ps
enable the podman-remote client to be able to create and list
pods on a remote system.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-25 09:10:09 -06:00
OpenShift Merge Robot cc4adddeb7
Merge pull request #2413 from baude/remotepodstop
Enable more podman-remote pod commands
2019-02-24 03:13:25 +01:00
OpenShift Merge Robot 3825db5aee
Merge pull request #2404 from baude/remoteerrors
make remote-client error messaging more robust
2019-02-23 22:10:03 +01:00
Daniel J Walsh b87bdced1f
Fix up handling of user defined network namespaces
If user specifies network namespace and the /etc/netns/XXX/resolv.conf
exists, we should use this rather then /etc/resolv.conf

Also fail cleaner if the user specifies an invalid Network Namespace.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-02-23 05:47:27 -05:00
baude 4bf973a9f6 Enable more podman-remote pod commands
enable pod start, stop, and kill subcommands for the remote-client.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-22 17:00:24 -06:00
Giuseppe Scrivano 8984ba7461
rootless: force same cwd when re-execing
when joining an existing namespace, we were not maintaining the
current working directory, causing commands like export -o to fail
when they weren't referring to absolute paths.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-22 23:55:21 +01:00
baude 6208d53464 make remote-client error messaging more robust
the remote-client is currently weak for carrying error messages
over the varlink interface and displaying something useful to users
and developers for the purposes of debug.  this is a starting point
to improve that user experience.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-22 14:12:36 -06:00
baude bc6b4aa39c podman-remote pod inspect|exists
enable the remote client to be able to inspect a pod.  also, bonus of
enabling the podman pod exists command which returns a 0 or 1 depending
on whether the given pod exists.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-22 11:08:04 -06:00
baude 71db80ddb1 podman-remote load image
enable the ability to load an image into remote storage
using the remote client.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-21 10:11:19 -06:00
OpenShift Merge Robot 28d6eeb57a
Merge pull request #2387 from baude/remotepodrm
enable podman-remote pod rm
2019-02-21 16:51:23 +01:00
baude e91ec38a70 enable podman-remote pod rm
add the ability to delete a pod from the remote client.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-21 08:40:42 -06:00
Harald Hoyer 3f60dc02e3
Adjust LISTEN_PID for reexec in varlink mode
Because the varlink server honors the socket activation protocol,
LISTEN_PID has to be adjusted with the new PID.

https://varlink.org/FAQ.html#how-does-socket-activation-work
Signed-off-by: Harald Hoyer <harald@redhat.com>
2019-02-21 10:25:57 +01:00
baude 711ac93051 podman-remote save [image]
Add the ability to save an image from the remote-host to the
remote-client.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-20 12:58:05 -06:00
Valentin Rothberg 6ae4401bd1 iopodman.SearchImages: add ImageSearchFilter to Varlink API
Also add some argument checks to the Varlink function to avoid
referencing nil pointers, and complement the API.md descriptions.

The varlink endpoint can be tested via varlink CLI:

$ varlink call -m unix:/run/podman/io.podman/io.podman.SearchImages \
      '{"query": "ruby", "limit": 0, "tlsVerify": false, "filter": {}}'

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-20 10:25:25 +01:00
Valentin Rothberg 8a49b59ed4 image.SearchImages: use SearchFilter type
Use an `image.SearchFilter` instead of a `[]string` in the SearchImages
API.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-20 10:25:25 +01:00
Valentin Rothberg 0d3eaca28a SearchImages: extend API with filter parameter
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-20 10:25:25 +01:00
Valentin Rothberg 87c9f4cc22 podman-search: refactor code to libpod/image/search.go
Refactor the image-search logic from cmd/podman/search.go to
libpod/image/search.go and update podman-search and the Varlink API to
use it.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-20 10:25:25 +01:00
baude 8f40c4e6b4 podman-remote pull
Add status for remote users and podman remote-client pull.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-19 10:13:07 -06:00
Sebastian Jug 7141f97270 OpenTracing support added to start, stop, run, create, pull, and ps
Drop context.Context field from cli.Context

Signed-off-by: Sebastian Jug <sejug@redhat.com>
2019-02-18 09:57:08 -05:00
OpenShift Merge Robot e738ef1622
Merge pull request #2354 from rhatdan/varlink
Add registry name to fields returned by varlink image search
2019-02-18 13:32:54 +01:00
Peter Hunt 81804fc464 pod infra container is started before a container in a pod is run, started, or attached.
Prior, a pod would have to be started immediately when created, leading to confusion about what a pod state should be immediately after creation. The problem was podman run --pod ... would error out if the infra container wasn't started (as it is a dependency). Fix this by allowing for recursive start, where each of the container's dependencies are started prior to the new container. This is only applied to the case where a new container is attached to a pod.

Also rework container_api Start, StartAndAttach, and Init functions, as there was some duplicated code, which made addressing the problem easier to fix.

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-02-15 16:39:24 -05:00
Daniel J Walsh b75dcd4458
Add registry name to fields returned by varlink image search
Cockpit team wants to list the registry name where the image was
found.

Also fix up SearchImages code to check if the user specified a registry
in his call to use that rather then all the registries, This matches
podman search command.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-02-15 15:30:09 -05:00
OpenShift Merge Robot d512c4d255
Merge pull request #2305 from rhatdan/tlsverify
Add tlsVerify bool to SearchImage for varlink
2019-02-15 10:50:36 +01:00
OpenShift Merge Robot ae8cc41295
Merge pull request #2332 from baude/remotevolumeprune
volume prune
2019-02-14 22:52:03 +01:00
Daniel J Walsh 5f7d4ee73f
Add tlsVerify bool to SearchImage for varlink
Cockpit wants to be able to search images on systems without
tlsverify turned on.

tlsverify should be an optional parameter, if not set then we default
to the system defaults defined in /etc/containers/registries.conf.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-02-14 14:31:20 -05:00
Daniel J Walsh 52df1fa7e0
Fix volume handling in podman
iFix builtin volumes to work with podman volume

Currently builtin volumes are not recored in podman volumes when
they are created automatically. This patch fixes this.

Remove container volumes when requested

Currently the --volume option on podman remove does nothing.
This will implement the changes needed to remove the volumes
if the user requests it.

When removing a volume make sure that no container uses the volume.

Signed-off-by: Daniel J Walsh dwalsh@redhat.com
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-02-14 13:21:52 -05:00
baude 5be818e715 enable podman-remote volume prune
allow users to remotely prune volumes.

this is the last volume command for remote enablement.  as such,
the volume commands are being folded back into main because they
are supported for both local and remote clients.

also, enable all volume tests that do not use containers
as containers are not enabled for the remote client yet.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-14 10:55:05 -06:00
OpenShift Merge Robot 0cd2243596
Merge pull request #2321 from baude/remotebuild
podman-remote build
2019-02-14 15:40:52 +01:00
OpenShift Merge Robot dfc64e15d7
Merge pull request #2319 from mheon/unconditional_cleanup
Fix manual detach from containers to not wait for exit
2019-02-13 22:55:52 +01:00
baude ef85dd7950 podman-remote build
add the ability to build images using files local to the remote-client
but over a varlink interface to a "remote" server.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-13 15:36:36 -06:00
baude 4f60f79a27 podman-remote volume inspect|ls
add the ability to list and inspect volumes using the remote
client and varlink

Signed-off-by: baude <bbaude@redhat.com>
2019-02-13 12:43:51 -06:00
baude 7dcc21f213 podman-remote push
enable podman-remote push so that users can push images from a
remote client.

change in push API to deal with the need to see output over the
varlink connection.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-13 08:44:12 -06:00
Matthew Heon b6775d5d22 Fix manual detach from containers to not wait for exit
At present, when manually detaching from an attached container
(using the detach hotkeys, default C-p C-q), Podman will still
wait for the container to exit to obtain its exit code (so we can
set Podman's exit code to match). This is correct in the case
where attach finished because the container exited, but very
wrong for the manual detach case.

As a result of this, we can no longer guarantee that the cleanup
and --rm functions will fire at the end of 'podman run' - we may
be exiting before we get that far. Cleanup is easy enough - we
swap to unconditionally using the cleanup processes we've used
for detached and rootless containers all along. To duplicate --rm
we need to also teach 'podman cleanup' to optionally remove
containers instead of cleaning them up.

(There is an argument for just using 'podman rm' instead of
'podman cleanup --rm', but cleanup does have different semantics
given that we only ever expect it to run when the container has
just exited. I think it might be useful to keep the two separate
for things like 'podman events'...)

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-02-12 10:14:57 -05:00
Lars Karlitski 2448129e4d varlink: Rename SearchImage to SearchImages
Also rename image result struct to `ImageSearchResult` and make `limit`
parameter optional.

Signed-off-by: Lars Karlitski <lars@karlitski.net>
2019-02-12 14:48:19 +01:00
Lars Karlitski 5a32518170 varlink: Rename ContainerInList to Container
Container more clearly describes what the type represents.

Signed-off-by: Lars Karlitski <lars@karlitski.net>
2019-02-12 14:48:19 +01:00
Lars Karlitski 8a51b11058 varlink: Rename ImageInList to Image
Image more clearly describes what the type represents.

Also, only include the image name in the `ImageNotFound` error returned
by `GetImage()`, not the full error message.

Signed-off-by: Lars Karlitski <lars@karlitski.net>
2019-02-12 14:48:19 +01:00
Lars Karlitski 27baf9970e varlink: Simplify GetVersion() call
Not having the `Version` wrapper type makes it easier for clients to
work with the returned data.

Signed-off-by: Lars Karlitski <lars@karlitski.net>
2019-02-12 14:47:49 +01:00
Lars Karlitski 29392b77e9 varlink: Return all times in RFC 3339 format
This is more consistent and eaiser to parse than the format that
golang's time.String() returns.

Fixes #2260

Signed-off-by: Lars Karlitski <lars@karlitski.net>
2019-02-12 14:47:49 +01:00
Lars Karlitski 608019b65b varlink: Remove the Ping() method
There are other ways for developers to "ensure their varlink setup is
working", for example by calling `GetVersion()` or any call on the
org.varlink.service interface.

Signed-off-by: Lars Karlitski <lars@karlitski.net>
2019-02-12 14:47:49 +01:00
Lars Karlitski a097772cf7 varlink: Remove NotImplemented type
Remove the `NotImplemented` type and comment out the methods that use
it. This way we can keep track of the methods that still need to be
implemented without committing them to stable API.

Signed-off-by: Lars Karlitski <lars@karlitski.net>
2019-02-12 14:47:49 +01:00
baude 3101364a3c podman-remote volume rm
add the ability to remove/delete volumes with the podman remote
client.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-11 20:14:50 -06:00
baude 358da6c8c0 podman-remote volume create
create a volume using the remote client over varlink

Signed-off-by: baude <bbaude@redhat.com>
2019-02-11 14:48:07 -06:00
baude 25a3923b61 Migrate to cobra CLI
We intend to migrate to the cobra cli from urfave/cli because the
project is more well maintained.  There are also some technical reasons
as well which extend into our remote client work.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-08 10:26:43 -06:00
Giuseppe Scrivano 1a8391b914
cleanup: use the correct runtime
make sure "containers cleanup" uses the correct runtime if it was
overriden.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-07 14:59:59 +01:00
OpenShift Merge Robot dab590d13e
Merge pull request #2278 from rhatdan/varlink
Fix handling of memory limits via varlink
2019-02-07 00:34:59 +01:00
OpenShift Merge Robot 74e71c41d2
Merge pull request #2268 from mheon/force_storage_refresh
Unconditionally refresh storage options from config
2019-02-06 23:15:24 +01:00
OpenShift Merge Robot 9644802cd7
Merge pull request #2279 from giuseppe/pts-no-override-if-not-needed
rootless: do not override /dev/pts if not needed
2019-02-06 20:28:15 +01:00
Matthew Heon 33845f8a0f Unconditionally refresh storage options from config
Due to our unconditionally setting some storage options, we
are not always reading storage options from storage.conf. This
can lead to some fields in the storage config (most notably extra
storage options) being ignored, despite being set in
storage.conf.

Resolve this by unconditionally refreshing our storage config
from storage.conf (this was previously only done for rootless
Podman)

Fixes #2217

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-06 10:01:43 -05:00
Giuseppe Scrivano e2970ea62d
rootless: do not override /dev/pts if not needed
when running in rootless mode we were unconditionally overriding
/dev/pts to take ride of gid=5.  This is not needed when multiple gids
are present in the namespace, which is always the case except when
running the tests suite with only one mapping.  So change it to check
how many gids are present before overriding the default mount.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-06 15:31:20 +01:00
Daniel J Walsh 3416bb20f2
Fix handling of memory limits via varlink
Currently handlin memory via varlink is hard coded to 0
Changing to
			Memory:            create.Resources.Memory,
			MemoryReservation: create.Resources.Memory_reservation,
			MemorySwap:        create.Resources.Memory_swap,
			MemorySwappiness:  int(create.Resources.Memory_swappiness),
			KernelMemory:      create.Resources.Kernel_memory,
Allows callers to modify these memory settings.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-02-06 06:22:13 -08:00
baude 64c8fb7c24 podman-remote import|export
addition of import and export for the podman-remote client.  This includes
the ability to send and receive files between the remote-client and the
"podman" host using an upgraded varlink connection.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-05 10:05:41 -06:00
Daniel J Walsh 3554bfce98
Merge pull request #2196 from baude/toolbox
Changes to container runlabel for toolbox project
2019-02-05 10:34:40 -05:00
OpenShift Merge Robot 8e79420489
Merge pull request #2143 from QiWang19/continue2108
Fix up `image sign` in PR 2108
2019-02-01 17:12:50 +01:00
OpenShift Merge Robot f0d64a9e3e
Merge pull request #2236 from baude/listcontainermountsmap
Alter varlink API for ListContainerMounts to return a map
2019-02-01 03:23:34 +01:00
baude 735f0de633 Changes to container runlabel for toolbox project
The toolbox project would benefit from a few changes to more closely
resembe the original atomic cli project.  Changes made are:

* only pull image for container runlabel if the label exists in the image
* if a container image does not have the desired label, exit with non-zero

Signed-off-by: baude <bbaude@redhat.com>
2019-01-30 08:44:58 -06:00
OpenShift Merge Robot b01ec95bda
Merge pull request #2225 from cevich/enable_apparmor
Cirrus: Enable AppArmor build and test
2019-01-30 11:23:05 +01:00
baude 656033ca96 podman image prune -- implement all flag
we now, by default, only prune dangling images.  if --all is passed, we
prune dangling images AND images that do not have an associated containers.

also went ahead and enabled the podman-remote image prune side of things.

Fixes: #2192

Signed-off-by: baude <bbaude@redhat.com>
2019-01-29 16:51:48 -06:00
baude 9e22fbf679 Alter varlink API for ListContainerMounts to return a map
We want to return a map of containermounts where the key is container
id and it points to the mountpath.

Issue #2215

Signed-off-by: baude <bbaude@redhat.com>
2019-01-29 16:47:27 -06:00
Valentin Rothberg 18b7009754
apparmor: don't load default profile in rootless mode
AppArmor requires root privileges, so skip loading the default profile
in rootless mode.  Also add a log to ease debugging.

Fixes: #2223
Reported-by: @dmacvicar
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-01-29 10:38:52 -05:00
baude 5c8e7ed0de enable podman-remote version
initial enablement of podman-remote version.  includes add a APIVersion const
that will allow us to check compatibility between host/client when connections
are made.

also added client related information to podman info.

Signed-off-by: baude <bbaude@redhat.com>
2019-01-21 15:23:30 -06:00
OpenShift Merge Robot 74b85098cf
Merge pull request #2142 from giuseppe/expose-ports
rootless: support port redirection from the host
2019-01-20 13:25:37 +01:00
Giuseppe Scrivano f182946bef
rootless: support port redirection from the host
add support for ports redirection from the host.

It needs slirp4netns v0.3.0-alpha.1.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-19 20:45:07 +01:00
baude eadaa5fb42 podman-remote inspect
base enablement of the inspect command.

Signed-off-by: baude <bbaude@redhat.com>
2019-01-18 15:43:11 -06:00
Giuseppe Scrivano 8156f8c694
rootless: fix --pid=host without --privileged
When using --pid=host don't try to cover /proc paths, as they are
coming from the /proc bind mounted from the host.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-18 17:12:28 +01:00
Daniel J Walsh 0abb757425
Cleanup coverity scan issues
If realloc fails, then buffer will be leaked, this change frees up the buffer.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-15 17:09:15 -05:00
Qi Wang e24167eef9 Fix up image sign in PR 2108
Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-01-15 12:25:10 -05:00
OpenShift Merge Robot 140ae25c4d
Merge pull request #2141 from baude/remotetag
Add darwin support for remote-client
2019-01-13 09:34:33 -08:00
baude e10baba326 podman play kube: add containers to pod
when defining containers, we missed the conditional logic to allow
the container to be defined with "WithPod" and so forth.  I had to
slightly modify the createcontainer process to pass a libpod.Pod
that could override things; use nil as no pod.

Signed-off-by: baude <bbaude@redhat.com>
2019-01-11 14:01:57 -06:00
baude 43c6da22b9 Add darwin support for remote-client
Add the ability to cross-compile podman remote for OSX.

Also, add image exists and tag to remote-client.

Signed-off-by: baude <bbaude@redhat.com>
2019-01-11 11:30:28 -06:00
OpenShift Merge Robot 28c35cab87
Merge pull request #2135 from baude/varlinkprune
Add varlink support for prune
2019-01-11 06:18:29 -08:00
OpenShift Merge Robot 9368c24be6
Merge pull request #2113 from baude/remoteimages
remote-client support for images
2019-01-11 05:54:16 -08:00
baude 7459c48863 Add varlink support for prune
Add the ability to prune unused images using the varlink
API.

Signed-off-by: baude <bbaude@redhat.com>
2019-01-10 15:21:42 -06:00
OpenShift Merge Robot 36d96c19f9
Merge pull request #2131 from mheon/restore_storage_defaults
Use defaults if paths are not specified in storage.conf
2019-01-10 11:58:13 -08:00
OpenShift Merge Robot 4fb6045087
Merge pull request #2108 from QiWang19/from1899
Fix 'image trust' from PR1899
2019-01-10 11:57:59 -08:00
baude c8e3dd8a9c remote-client support for images
Signed-off-by: baude <bbaude@redhat.com>
2019-01-10 13:18:08 -06:00
Matthew Heon 2fe6ada854 Use defaults if paths are not specified in storage.conf
For rootless Podman, if storage.conf exists but does not specify
one or both of RunRoot and GraphRoot, set them to rootless
defaults so we don't end up with an unusable configuration.

Fixes #2125

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-01-10 13:19:51 -05:00
Giuseppe Scrivano 7ba38b375f
createconfig: always cleanup a rootless container
the rootless container storage is always mounted in a different mount
namespace, owned by the unprivileged user.  Even if it is mounted, a
process running in another namespace cannot reuse the already mounted
storage.

Make sure the storage is always cleaned up once the container
terminates.

This has worked with vfs since there is no real mounted storage.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-10 13:02:58 +01:00
OpenShift Merge Robot 64627d910b
Merge pull request #2114 from vrothberg/issue-2107
apparmor: apply default profile at container initialization
2019-01-10 03:34:54 -08:00
Qi Wang b01b2a78f4 Fix 'image trust' from PR1899
Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-01-09 17:48:47 -05:00
W. Trevor King 0f6535cf6b libpod/image: Use ParseNormalizedNamed in RepoDigests
Avoid generating
quay.io/openshift-release-dev/ocp-release@sha256@sha256:239... and
similar when the image name is already digest-based [1].  It's not
clear exactly how we get into this state, but as shown by the unit
tests, the new code handles this case correctly (while the previous
code does not).

[1]: https://github.com/containers/libpod/issues/2086

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #2106
Approved by: rhatdan
2019-01-09 22:29:18 +00:00
Valentin Rothberg edb285d176 apparmor: apply default profile at container initialization
Apply the default AppArmor profile at container initialization to cover
all possible code paths (i.e., podman-{start,run}) before executing the
runtime.  This allows moving most of the logic into pkg/apparmor.

Also make the loading and application of the default AppArmor profile
versio-indepenent by checking for the `libpod-default-` prefix and
over-writing the profile in the run-time spec if needed.

The intitial run-time spec of the container differs a bit from the
applied one when having started the container, which results in
displaying a potentially outdated AppArmor profile when inspecting
a container.  To fix that, load the container config from the file
system if present and use it to display the data.

Fixes: #2107
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-01-09 22:18:11 +01:00
W. Trevor King 99e642d940 pkg/hooks/exec: Include failed command in hook errors
For example:

  $ cat /etc/containers/oci/hooks.d/test.json
  {
    "version": "1.0.0",
    "hook": {
      "path": "/bin/sh",
      "args": ["sh", "-c", "echo 'oh, noes!' >&2; exit 1"]
    },
    "when": {
      "always": true
    },
    "stages": ["precreate"]
  }
  $ podman run --rm docker.io/library/alpine echo 'successful container'
  error setting up OCI Hooks: executing [sh -c echo 'oh, noes!' >&2; exit 1]: exit status 1

The rendered command isn't in in the right syntax for copy/pasting
into a shell, but it should be enough for the user to be able to
locate the failing hook.  They'll need to know their hook directories,
but with the previous commits requiring explicit hook directories it's
more likely that the caller is aware of them.  And if they run at a
debug level, they can see the lookups in the logs:

  $ podman --log-level=debug --hooks-dir=/etc/containers/oci/hooks.d run --rm docker.io/library/alpine echo 'successful container' 2>&1 | grep -i hook
  time="2018-12-02T22:15:16-08:00" level=debug msg="reading hooks from /etc/containers/oci/hooks.d"
  time="2018-12-02T22:15:16-08:00" level=debug msg="added hook /etc/containers/oci/hooks.d/test.json"
  time="2018-12-02T22:15:16-08:00" level=debug msg="hook test.json matched; adding to stages [precreate]"
  time="2018-12-02T22:15:16-08:00" level=warning msg="container 3695c6ba0cc961918bd3e4a769c52bd08b82afea5cd79e9749e9c7a63b5e7100: precreate hook: executing [sh -c echo 'oh, noes!' >&2; exit 1]: exit status 1"
  time="2018-12-02T22:15:16-08:00" level=error msg="error setting up OCI Hooks: executing [sh -c echo 'oh, noes!' >&2; exit 1]: exit status 1"

Signed-off-by: W. Trevor King <wking@tremily.us>
2019-01-08 21:06:17 -08:00
W. Trevor King c441d51e05 hooks/exec/runtimeconfigfilter: Log config changes
To make it easier to notice and track down errors (or other surprising
behavior) due to precreate hooks.  With this commit, the logged
messages look like:

  time="2018-11-19T13:35:18-08:00" level=debug msg="precreate hook 0 made configuration changes:
  --- Old
  +++ New
  @@ -18,3 +18,3 @@
     Namespaces: ([]specs.LinuxNamespace) <nil>,
  -  Devices: ([]specs.LinuxDevice) (len=1) {
  +  Devices: ([]specs.LinuxDevice) (len=2) {
      (specs.LinuxDevice) {
  @@ -24,2 +24,11 @@
       Minor: (int64) 229,
  +    FileMode: (*os.FileMode)(-rw-------),
  +    UID: (*uint32)(0),
  +    GID: (*uint32)(0)
  +   },
  +   (specs.LinuxDevice) {
  +    Path: (string) (len=8) "/dev/sda",
  +    Type: (string) (len=1) "b",
  +    Major: (int64) 8,
  +    Minor: (int64) 0,
       FileMode: (*os.FileMode)(-rw-------),
  "
  time="2018-11-19T13:35:18-08:00" level=debug msg="precreate hook 1 made configuration changes:
  --- Old
  +++ New
  @@ -29,3 +29,3 @@
      (specs.LinuxDevice) {
  -    Path: (string) (len=8) "/dev/sda",
  +    Path: (string) (len=8) "/dev/sdb",
       Type: (string) (len=1) "b",
  "

Ideally those logs would include the container ID, but we don't have
access to that down at this level.  I'm not sure if it's worth
teaching RuntimeConfigFilter to accept a *logrus.Entry (so the caller
could use WithFields [1]) or to use a generic logging interface (like
go-log [2]).  For now, I've left the container ID unlogged here.

The spew/difflib implementation is based on stretchr/testify/assert,
but I think the ~10 lines I'm borrowing are probably small enough to
stay under the "all copies or substantial portions" condition in its
MIT license.

[1]: https://godoc.org/github.com/sirupsen/logrus#WithFields
[2]: https://github.com/go-log/log

Signed-off-by: W. Trevor King <wking@tremily.us>
2019-01-08 21:06:17 -08:00
W. Trevor King f6a2b6bf2b hooks: Add pre-create hooks for runtime-config manipulation
There's been a lot of discussion over in [1] about how to support the
NVIDIA folks and others who want to be able to create devices
(possibly after having loaded kernel modules) and bind userspace
libraries into the container.  Currently that's happening in the
middle of runc's create-time mount handling before the container
pivots to its new root directory with runc's incorrectly-timed
prestart hook trigger [2].  With this commit, we extend hooks with a
'precreate' stage to allow trusted parties to manipulate the config
JSON before calling the runtime's 'create'.

I'm recycling the existing Hook schema from pkg/hooks for this,
because we'll want Timeout for reliability and When to avoid the
expense of fork/exec when a given hook does not need to make config
changes [3].

[1]: https://github.com/opencontainers/runc/pull/1811
[2]: https://github.com/opencontainers/runc/issues/1710
[3]: https://github.com/containers/libpod/issues/1828#issuecomment-439888059

Signed-off-by: W. Trevor King <wking@tremily.us>
2019-01-08 21:06:17 -08:00
OpenShift Merge Robot 4f19f1afca
Merge pull request #2076 from rhatdan/storage.conf
If local storage file exists, then use it rather then defau…
2019-01-08 05:55:40 -08:00
OpenShift Merge Robot faa24627bb
Merge pull request #2078 from rhatdan/config.file
Add the configuration file used to setup storage to podman info
2019-01-07 14:27:19 -08:00
OpenShift Merge Robot 8c8d895d66
Merge pull request #2098 from baude/remote
Add ability to build golang remote client
2019-01-07 11:54:55 -08:00
baude 41fb81d074 Add ability to build golang remote client
Add the ability to build a remote client in golang that uses all
the same front-end cli code and output code. The initial limitations
here are that it can only be a local client while the bridge and
resolver code is being written for the golang varlink client.

Tests and docs will be added in subsequent PRs.

Signed-off-by: baude <bbaude@redhat.com>
2019-01-07 12:43:57 -06:00
Daniel J Walsh b367855d5f
Add the configuration file used to setup storage to podman info
Users have no idea what storage configuration file is used to setup
storage, so adding this to podman info, should make it easier to
discover.

This requires a revendor of containers/storage

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-07 10:02:26 -05:00
OpenShift Merge Robot b83b07cb47
Merge pull request #2082 from rhatdan/runc
Update vendor of runc
2019-01-06 17:27:50 -08:00
Daniel J Walsh 43686072d3
Update vendor of runc
Updating the vendor or runc to pull in some fixes that we need.
In order to get this vendor to work, we needed to update the vendor
of docker/docker, which causes all sorts of issues, just to fix
the docker/pkg/sysinfo.  Rather then doing this, I pulled in pkg/sysinfo
into libpod and fixed the code locally.

I then switched the use of docker/pkg/sysinfo to libpod/pkg/sysinfo.

I also switched out the docker/pkg/mount to containers/storage/pkg/mount

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-04 14:54:59 -05:00
Valentin Rothberg 75578aad61 add container-init support
Add support for executing an init binary as PID 1 in a container to
forward signals and reap processes.  When the `--init` flag is set for
podman-create or podman-run, the init binary is bind-mounted to
`/dev/init` in the container and "/dev/init --" is prepended to the
container's command.

The default base path of the container-init binary is `/usr/libexec/podman`
while the default binary is catatonit [1].  This default can be changed
permanently via the `init_path` field in the `libpod.conf` configuration
file (which is recommended for packaging) or temporarily via the
`--init-path` flag of podman-create and podman-run.

[1] https://github.com/openSUSE/catatonit

Fixes: #1670
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-01-04 11:42:03 +01:00
Daniel J Walsh b0fcd555db
If local storage file exists, then use it rather then defaults.
Currently we always force overlay if it exists even though a user might want
vfs.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-03 16:25:02 -05:00
Daniel J Walsh c141c5cfd2
Fix handling of symbolic links
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-12-28 13:10:15 -05:00
Daniel J Walsh df99522c67
Fixes to handle /dev/shm correctly.
We had two problems with /dev/shm, first, you mount the
container read/only then /dev/shm was mounted read/only.
This is a bug a tmpfs directory should be read/write within
a read-only container.

The second problem is we were ignoring users mounted /dev/shm
from the host.

If user specified

podman run -d -v /dev/shm:/dev/shm ...

We were dropping this mount and still using the internal mount.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-12-24 09:03:53 -05:00
Šimon Lukašík 4e85f468fc Refactor: use idtools.ParseIDMap instead of bundling own version
ParseIDMap function was extracted to idtools in

    https://github.com/containers/storage/pull/236

it is already used in containers/storage and buildah, it should be used in
libpod as well.

Signed-off-by: Šimon Lukašík <isimluk@fedoraproject.org>
2018-12-23 12:07:54 +01:00
Daniel J Walsh c657dc4fdb
Switch all referencs to image.ContainerConfig to image.Config
This will more closely match what Docker is doing.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-12-21 15:59:34 -05:00
Daniel J Walsh 1ad6f9af15
Allow users to specify a directory for additonal devices
Podman will search through the directory and will add any device
nodes that it finds.  If no devices are found we return an error.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-12-21 10:28:14 -05:00
Daniel J Walsh 4d13262405
Change all 'can not' to 'cannot' for proper usage
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-12-21 10:27:54 -05:00
Daniel J Walsh 664076c259
Invalid index for array
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-12-21 09:25:25 -05:00
Giuseppe Scrivano f2e96b0934
rootless: add function to join user and mount namespace
Add the possibility to join directly the user and mount namespace
without looking up the parent of the user namespace.

We need this in order to be able the conmon process, as the mount
namespace is kept alive only there.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-12-21 09:46:05 +01:00
Qi Wang 31edf47285 Support podman image trust command
Display the trust policy of the host system. The trust policy is stored in the /etc/containers/policy.json file and defines a scope of registries or repositories.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2018-12-19 13:36:11 -05:00
baude 06d763d964 Clean up some existing varlink endpoints
Going through and adding options (like tls-verify, signature option, etc)
to some varlink endpoints (like push/pull) many of which had not been
updated since their original authoring.

Signed-off-by: baude <bbaude@redhat.com>
2018-12-12 12:53:09 -06:00
baude 078fd071c1 add more example usage to varlink endpoints
Signed-off-by: baude <bbaude@redhat.com>
2018-12-09 11:16:33 -06:00
baude 5209894100 add timeout to pod stop
like podman stop of containers, we should allow the user to specify
a timeout override when stopping pods; otherwise they have to wait
the full timeout time specified during the pod/container creation.

Signed-off-by: baude <bbaude@redhat.com>
2018-12-07 10:27:41 -06:00
Miloslav Trmač 93e14b6198 Remove the forceSecure parameter on the pull call stack
DockerRegistryOptions.DockerInsecureSkipTLSVerify as an types.OptionalBool
can now represent that value, so forceSecure is redundant.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-06 23:34:59 +01:00
Miloslav Trmač 8150c942d5 Factor out the registries.conf location code in pkg/registries
The newly introduced SystemRegistriesConfPath somewhat decreases
duplication, but more importantly will allow future callers to
set just a types.SystemContext.SystemRegistriesConfPath and not call
GetRegistries / GetInsecureRegistries at all.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-06 23:34:59 +01:00
Miloslav Trmač 7407d6621c Remove the forceSecure parameter of Image.PushImageTo*
DockerRegistryOptions.DockerInsecureSkipTLSVerify as an types.OptionalBool
can now represent that value, so forceSecure is redundant.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-06 23:34:59 +01:00
Miloslav Trmač b134951d14 Minimally update for the DockerInsecureSkipTLSVerify type change
Following SystemContext.DockerInsecureSkipTLSVerify, make the
DockerRegistryOne also an OptionalBool, and update callers.

Explicitly document that --tls-verify=true and --tls-verify unset
have different behavior in those commands where the behavior changed
(or where it hasn't changed but the documentation needed updating).

Also make the --tls-verify man page sections a tiny bit more consistent
throughout.

This is a minimal fix, without changing the existing "--tls-verify=true"
paths nor existing manual insecure registry lookups.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-06 23:34:59 +01:00
umohnani8 4c70b8a94b Add "podman volume" command
Add support for podman volume and its subcommands.
The commands supported are:
	podman volume create
	podman volume inspect
	podman volume ls
	podman volume rm
	podman volume prune

This is a tool to manage volumes used by podman. For now it only handle
named volumes, but eventually it will handle all volumes used by podman.

Signed-off-by: umohnani8 <umohnani@redhat.com>
2018-12-06 10:17:16 +00:00
OpenShift Merge Robot 6bb56a1c97
Merge pull request #1924 from baude/mroevarlinkendpoints
Adding more varlink endpoints
2018-12-05 14:55:27 -08:00
OpenShift Merge Robot be74acee1c
Merge pull request #1940 from wking/numeric-gid
libpod/container_internal_linux: Allow gids that aren't in the group file
2018-12-05 08:09:58 -08:00
OpenShift Merge Robot 50e754cd57
Merge pull request #1918 from mheon/use_db_paths
Use paths written in DB instead if they differ from our defaults
2018-12-05 00:55:48 -08:00
W. Trevor King 39df2093e8 pkg/lookup: Return ID-only pointers on ErrNo*Entries
Callers that only care about the IDs should try to convert the
identifier to an integer before calling the Get* functions, so they
can save the cost of hitting the filesystem and maybe or maybe not
finding the other fields (User.Name, etc.).  But callers that *want*
the other fields but only actually need the ID can, with this commit,
just call the Get* function and ignore ErrNo*Entries responses:

  user, err := lookup.GetUser(mount, userIDorName)
  if err != nil && err != ErrNoPasswdEntries {
    return err
  }

Previously, they'd have to perform their own integer-conversion
attempt in Get* error handling, with logic like:

  user, err := lookup.GetUser(mount, userIDorName)
  if err == ErrNoPasswdEntries {
    uuid, err := strconv.ParseUint(userIDorName, 10, 32)
    if err == nil {
      user.Uid = int(uuid)
    }
  } else if err != nil {
    return err
  }

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-12-04 14:46:43 -08:00
baude 9c359a31d5 create pod on the fly
when a user specifies --pod to podman create|run, we should create that pod
automatically.  the port bindings from the container are then inherited by
the infra container.  this signicantly improves the workflow of running
containers inside pods with podman.  the user is still encouraged to use
podman pod create to have more granular control of the pod create options.

Signed-off-by: baude <bbaude@redhat.com>
2018-12-03 15:49:17 -06:00
Matthew Heon 795fbba769 Revert changes to GetDefaultStoreOptions
We don't need this for anything more than rootless work in Libpod
now, but Buildah still uses it as it was originally written, so
leave it intact as part of our API.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-12-03 15:48:20 -05:00
baude 5c02dda869 Adding more varlink endpoints
* runlabel
* checkpoint
* restore
* container|image exists
* mount
* unmount

Signed-off-by: baude <bbaude@redhat.com>
2018-12-03 10:56:07 -06:00
Giuseppe Scrivano 727b6a78ee
rootless: raise error if newuidmap/newgidmap are not installed
it was reported on IRC that Podman on Ubuntu failed as
newuidmap/newgidmap were not installed by default.

Raise an error if we are not allowing single mappings (used only by
the tests suite) and any of the binaries is not present.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-12-03 16:45:44 +01:00
Matthew Heon b104a45f35 Fix gofmt and lint
Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-12-02 16:53:15 -05:00
Matthew Heon 562fa57dc9 Move rootless storage config into libpod
Previous commits ensured that we would use database-configured
paths if not explicitly overridden.

However, our runtime generation did unconditionally override
storage config, which made this useless.

Move rootless storage configuration setup to libpod, and change
storage setup so we only override if a setting is explicitly
set, so we can still override what we want.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-12-02 15:21:35 -05:00
OpenShift Merge Robot ade0b30844
Merge pull request #1846 from cgwalters/netns-dns-localhost
Use host's resolv.conf if no network namespace enabled
2018-11-28 07:58:55 -08:00
OpenShift Merge Robot d346996e15
Merge pull request #1849 from giuseppe/report-rootless-netmode
rootless: add new netmode "slirp4netns"
2018-11-28 06:18:28 -08:00
Giuseppe Scrivano 078cb630d3
rootless: store only subset of storage.conf
do not store the entire file but only the subset of what we have
modified.  Also, we were not writing the correct data.  Since it is
not trivial to serialize storage.conf correctly and all the various
supported options, serialize only what we care about.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-28 10:48:30 +01:00
Giuseppe Scrivano 95f22a2ca0
network: allow slirp4netns mode also for root containers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-28 09:21:59 +01:00
Colin Walters 870eed9378 Use host's resolv.conf if no network namespace enabled
My host system runs Fedora Silverblue 29 and I have NetworkManager's
`dns=dnsmasq` setting enabled, so my `/etc/resolv.conf` only has
`127.0.0.1`.

I also run my development podman containers with `--net=host`
for various reasons.

If we have a host network namespace, there's no reason not to just
use the host's nameserver configuration either.

This fixes e.g. accessing content on a VPN, and is also faster
since the container is using cached DNS.

I know this doesn't solve the bigger picture issue of localhost-DNS
conflicting with bridged networking, but that's far more involved,
probably requiring a DNS proxy in the container.  This patch
makes my workflow a lot nicer and was easy to write.

Signed-off-by: Colin Walters <walters@verbum.org>
2018-11-27 15:28:09 -05:00
Giuseppe Scrivano 4203df69ac
rootless: add new netmode "slirp4netns"
so that inspect reports the correct network configuration.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-27 21:10:16 +01:00
Qi Wang 5438ec1918 Add history and namespaceoptions to image inspect
Signed-off-by: Qi Wang <qiwan@redhat.com>
2018-11-26 10:56:55 -05:00
OpenShift Merge Robot fe4f09493f
Merge pull request #1829 from baude/enableportbindinginpods
Allow users to expose ports from the pod to the host
2018-11-20 08:53:21 -08:00
baude 690c52a113 Allow users to expose ports from the pod to the host
we need to allow users to expose ports to the host for the purposes
of networking, like a webserver.  the port exposure must be done at
the time the pod is created.

strictly speaking, the port exposure occurs on the infra container.

Signed-off-by: baude <bbaude@redhat.com>
2018-11-20 09:49:34 -06:00
Giuseppe Scrivano 027d6ca6de
rootless: create empty mounts.conf if it doesn't exist
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-19 12:58:11 +01:00
Giuseppe Scrivano a0079d7657
registries: check user registries file only in rootless mode
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-19 12:11:07 +01:00
Giuseppe Scrivano 937eb8413c
rootless: create storage.conf when it doesn't exist
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-19 12:11:06 +01:00
OpenShift Merge Robot 39ef6d43d0
Merge pull request #1756 from isimluk/update-dependent-metalinter
Update metalinter dependency
2018-11-16 05:02:03 -08:00
Giuseppe Scrivano 1e3ff69502
rootless: call IsRootless just once
we are calling this function several times, it is worth to store its
result and re-use it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-14 10:13:50 +01:00
Šimon Lukašík 9497b2254c Lint: InspectImage varlink api should return errors that occurred
Not just nil.

Addressing:
pkg/varlinkapi/images.go:273:15⚠️ ineffectual assignment to err (ineffassign)

Signed-off-by: Šimon Lukašík <slukasik@redhat.com>
2018-11-10 10:52:24 +01:00
Daniel J Walsh 542d8fe95f
Better document rootless containers
Need to return an error pointing user in right direction if rootless podman
fails, because of no /etc/subuid or /etc/subgid files.

Also fix up man pages to better describe rootless podman.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-11-10 04:46:06 -05:00
Giuseppe Scrivano c7926aa7ca
rootless: default to fuse-overlayfs when available
If fuse-overlayfs is present, rootless containers default to use it.
This can still be overriden either via the command line with
--storage-driver or in the ~/.config/containers/storage.conf
configuration file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-08 10:58:49 +01:00
Daniel J Walsh ae68bec75c
Don't fail if /etc/passwd or /etc/group does not exists
Container images can be created without passwd or group file, currently
if one of these containers gets run with a --user flag the container blows
up complaining about t a missing /etc/passwd file.

We just need to check if the error on read is ENOEXIST then allow the
read to return, not fail.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-11-07 11:41:51 -05:00