Commit graph

442 commits

Author SHA1 Message Date
Giuseppe Scrivano 3306d3e120 rootless: use $HOME/.config/containers/libpod.conf
If the file exists, use it to read the configuration.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #936
Approved by: rhatdan
2018-06-27 14:07:17 +00:00
Giuseppe Scrivano 20862c9746 rootless: do not configure additional groups
Additional groups are not allowed in an userNS.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #936
Approved by: rhatdan
2018-06-27 14:07:17 +00:00
Giuseppe Scrivano 4415bad6fe oci: set XDG_RUNTIME_DIR to the runtime from GetRootlessRuntimeDir()
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #936
Approved by: rhatdan
2018-06-27 14:07:17 +00:00
Giuseppe Scrivano 5ff90677c8 rootless: add management for the userNS
When running podman as non root user always create an userNS and let
the OCI runtime use it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #936
Approved by: rhatdan
2018-06-27 14:07:17 +00:00
Giuseppe Scrivano 8ee8f84734 container_internal: don't ignore error from cleanupNetwork()
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1002
Approved by: rhatdan
2018-06-27 13:43:33 +00:00
Matthew Heon 80131339b7 Mark containers invalid earlier during removal
Fixes a bug where we might try saving back to the database during
cleanup, which would fail as the container was already removed
from the database.

Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #1001
Approved by: rhatdan
2018-06-27 13:42:20 +00:00
Matthew Heon c3602075ec Make CGroups cleanup optional on whether they exist
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #981
Approved by: baude
2018-06-22 19:26:46 +00:00
Matthew Heon 3343456717 Add Refresh() to ctrs to refresh state after db change
The Refresh() function is used to reset a container's state after
a database format change to state is made that requires migration

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #981
Approved by: baude
2018-06-22 19:26:46 +00:00
umohnani8 088d5af879 Podman history now prints out intermediate image IDs
If the intermediate image exists in the store, podman history
will show the IDs of the intermediate image of each layer.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #982
Approved by: mheon
2018-06-22 15:19:34 +00:00
Marco Vedovati bb4db6d548 Fix image volumes access and mount problems on restart
Signed-off-by: Marco Vedovati <mvedovati@suse.com>

- Set srcPath permissions so that the container user can R/W it.

- Fix uninitialized spec.Mount when restarting a container.

- Check for srcPath instead of volumePath existence when setting up a
  volume mount point for a container.

- Set the overlay volumePath with the same owner and permissions as
  srcPath to allow proper access by the container user.

Closes #844

Closes: #951
Approved by: rhatdan
2018-06-22 14:06:05 +00:00
Daniel J Walsh 1d9e884232 We are using err in defer function, needs to be defined name
Since we are checking if err is non nil in defer function we need
to define it, so that the check will work correctly.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #985
Approved by: mheon
2018-06-22 13:43:19 +00:00
Giuseppe Scrivano da44d8d5c8
libpod: fix race with attach/start
Move the StartContainer call after the attach to the UNIX socket.  It
solves a race where the StartContainer could be done earlier and a
short-lived container could already exit by the time we tried to
attach to the socket.

Closes: https://github.com/projectatomic/libpod/issues/835

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-06-20 09:36:04 +02:00
Matthew Heon 2d0d1c4b5f Errors from closing a netns on removal from DB are nonfatal
Upon updating a container, if its network namespace has been
removed, we attempt to clean up the network namespace locally,
to ensure we don't leave hanging file descriptors. This triggers
cleanup code which assumes the network namespace still exists,
but it almost certainly was removed by whoever removed it from
the database. As such, we end up with unavoidable errors if we
don't want to leak FDs. Make these errors nonfatal and log them
because of this.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #962
Approved by: rhatdan
2018-06-19 15:32:34 +00:00
Matthew Heon 7676cd4b12 Add extra debug so we can tell apart postdelete hooks
Ensure we can identify what hook is running so we can tell which
are erroring.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #960
Approved by: rhatdan
2018-06-19 11:40:33 +00:00
umohnani8 db094f6e15 Add --all,-a flag to podman images
podman images will not show intermediate images by default.
To view all images, including intermediate images created during
a build, use the --all flag.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #947
Approved by: rhatdan
2018-06-18 14:41:51 +00:00
Wim 4d3db1b4a9 Add MacAddress to inspect
Signed-off-by: Wim <wim@42.be>

Closes: #955
Approved by: rhatdan
2018-06-18 14:20:30 +00:00
Valentin Rothberg b1e709806d top: make output tabular
Make the output of top tabular to be compatible with Docker.  Please
note, that any user-input for `GetContainerPidInformation(...)` will be
ignored until we have found a way to generically and reliably parse ps-1
output or until there is a go-lib to extract all the data from /proc in
a ps-1 compatible fashion.

Fixes: #458
Signed-off-by: Valentin Rothberg <vrothberg@suse.com>

Closes: #939
Approved by: rhatdan
2018-06-18 12:56:44 +00:00
Wim 9e134576e8 Add more network info ipv4/ipv6 and be more compatible with docker
Signed-off-by: Wim <wim@42.be>

Closes: #953
Approved by: mheon
2018-06-17 21:21:27 +00:00
Wim fc5e3706e9 Do not run iptablesDNS workaround on IPv6 addresses
Closes: #954
Approved by: mheon
2018-06-17 15:16:56 +00:00
Giuseppe Scrivano 733a6a5f10 container: specify path to error message
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:19 +00:00
Giuseppe Scrivano 4086a0f737 podman: use a different store for the rootless case
so that the user has rw access to it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
Giuseppe Scrivano a1ec6747f1 container: do not set any mapping when using a rootfs
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
Giuseppe Scrivano 5e699e28a7 podman: do not use Chown in rootless mode
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
Giuseppe Scrivano c976d49805 network: do not attempt to create a network in rootless mode
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
Giuseppe Scrivano de71441700 oci: do not use hooks in rootless mode
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
Giuseppe Scrivano 399c3a5e4b oci: do not set the cgroup path in Rootless mode
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
Giuseppe Scrivano 1e8ef3c897 container: do not add shm in rootless mode
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
Giuseppe Scrivano ca03627a80 oci: pass XDG_RUNTIME_DIR down to the OCI runtime
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
Giuseppe Scrivano 7bdfb4f9b3 podman: accept option --rootfs to use exploded images
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
Matthew Heon 8f1b7be275 Fix cleaning up network namespaces on detached ctrs
The containernetworking/plugins ns package does not support
unmounting and removing namespaces that were opened by another
process. Work around this by doing it ourself.

Closes: #858

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #949
Approved by: rhatdan
2018-06-15 09:15:58 +00:00
Matthew Heon cdb447bba2 Correctly report errors retrieving containers in ps
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #944
Approved by: rhatdan
2018-06-14 19:03:51 +00:00
Daniel J Walsh 1e9e530714 Remove container from state before cleaning up.
Attempt to cleanup as much of the container as possible, even if one
of the cleanup stages fails.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #895
Approved by: mheon
2018-06-10 11:10:11 +00:00
Daniel J Walsh dedc7cc329 Remove SELinux transition rule after conmon is started.
We have an issue where iptables command is being executed by podman
and attempted to run with a different label. This fix changes podman
to only change the label on the conmon command and then set the
SELinux interface back to the default.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #906
Approved by: giuseppe
2018-06-06 18:23:37 +00:00
haircommander 0699b39793 Added a defer to an Unlock that immediately followed a Lock
Signed-off-by: haircommander <pehunt@redhat.com>
2018-06-05 16:07:35 -04:00
W. Trevor King c9f763456c libpod: Execute poststop hooks locally
Instead of delegating to the runtime, since some runtimes do not seem
to handle these reliably [1].

[1]: https://github.com/projectatomic/libpod/issues/730#issuecomment-392959938

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

Closes: #864
Approved by: rhatdan
2018-06-04 18:36:40 +00:00
Daniel J Walsh 3c63a48bb8
Merge pull request #859 from rhatdan/onbuild
Add OnBuild support for podman build
2018-06-01 12:59:47 -04:00
Giuseppe Scrivano 46e0cf0ef8
runtime: add /usr/libexec/podman/conmon to the conmon paths
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-06-01 16:43:35 +02:00
Daniel J Walsh 29c831f9d6 Add OnBuild support for podman build
Only supported for docker formated images. OCI Does not support this flag.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-06-01 10:08:56 -04:00
baude 0eda60957d fix panic with podman pull
when there are no registries configured for the system and the user provided
a short image name, we panic'd due a logic bug in recent image pull changes.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #841
Approved by: rhatdan
2018-05-31 22:07:15 +00:00
Daniel J Walsh d6b8f62dd6 Catch does not exist error
There was a new line at the end of does not exist
which was causing this to fail.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #863
Approved by: baude
2018-05-31 19:28:00 +00:00
Daniel J Walsh 7c6034e161 We need to change the SELinux label of the conmon process to s0
If SELinux is enabled, we are leaking in pipes into the container
owned by conmon.  The container processes are not allowed to use
these pipes, if the calling process is fully ranged.  By changing
the level of the conmon process to s0, this allows container processes
to use the pipes.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #854
Approved by: mheon
2018-05-31 13:51:11 +00:00
Matthew Heon de13777e71 Make references to the Process part of Spec conditional
The OCI runtime spec does not require Process to be passed (IE,
it can be nil). Make most of our references to it conditional on
it existing.

Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #828
Approved by: mheon
2018-05-25 15:32:47 +00:00
umohnani8 c8b72e57a7 save and load should support multi-tag for docker-archive
The docker-archive tar files can have multiple tags for the same
image stored in it. Load pulls all the tags found in the archive
when loading a tar file. Save can oush multiple tags of the same
image to a tar archive.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #819
Approved by: rhatdan
2018-05-25 15:15:47 +00:00
Jhon Honce 684b544e9c Spell check strings and comments
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #831
Approved by: rhatdan
2018-05-25 08:45:15 +00:00
Matthew Heon b09fca74af Set Entrypoint from image only if not already set
Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #827
Approved by: rhatdan
2018-05-24 17:36:37 +00:00
Daniel J Walsh 05bc77f0cb Fix handling of command in images
Currently we are dropping the command entry from the create
line and using the image Cmd.  This change will only use the
image Cmd if the user did not specify a Cmd.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #823
Approved by: umohnani8
2018-05-23 18:39:06 +00:00
baude 82feafecdd podman create, start, getattachsocket
First pass at implement API endpoints for create and start.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #805
Approved by: baude
2018-05-21 19:26:56 +00:00
baude ca1c6ef5be honor multiple change values
In the case where changes are made to Env, Expose, Volumes, or labels, we should
honor that multiple values are valid.

Resolves: #795

Signed-off-by: baude <bbaude@redhat.com>

Closes: #815
Approved by: mheon
2018-05-21 16:13:16 +00:00
Matthew Heon 18f9e8d94f Refresh pods when refreshing podman state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #784
Approved by: rhatdan
2018-05-17 23:10:12 +00:00
Matthew Heon 7e1ea9d26d Add per-pod CGroups
Pods can now create their own (cgroupfs) cgroups which containers
in them can (optionally) use.

This presently only works with CGroupFS, systemd cgroups are
still WIP

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #784
Approved by: rhatdan
2018-05-17 23:10:12 +00:00