Commit Graph

116 Commits

Author SHA1 Message Date
Giuseppe Scrivano c24f685d3f
utils: fix check for missing conf file
the previous error condition was causing an early failure when the
configuration file existed.  It prevented some additional checks and
to correctly set the RunRoot and GraphRoot to their default values
when they are not overriden in the configuration file.

We have not noticed it earlier as Podman would still use the
configuration from the DB in this case, so the issue is visible with
Podman only when the RunRoot is not specified in the configuration
file and in the libpod DB as well.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-06-23 23:28:48 +02:00
Daniel J Walsh 2bf9e95198
Return XDG_RUNTIME_DIR as RootlessRuntimeDir if set
We are currently ignoring XDG_RUNTIME_DIR if it is set, while
we should be using it.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-06-07 17:19:03 -04:00
Giuseppe Scrivano 8d53d451cc
utils: root in a userns uses global conf file
If the root user created a new user namespace, it still has to use the
system configuration and storage.

Previously if root created a user namespace when missing
CAP_SYS_ADMIN, we would use the configuration file under
/root/.config/containers instead of /etc/containers.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-04-23 14:12:03 +02:00
Daniel J Walsh aba92c81f9
Correctly check permissions on rootless directory
We have not been checking the permissions on the rootless directory
this causes issues in tools trying to access the login directory
if XDG_RUNTIME_DIR is not set correctly.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-04-17 10:22:48 -04:00
Giuseppe Scrivano 3dd479804f
storage: move the logic to detect rootless into utils.go
add a helper function that automatically detects the UID when running
in a user namespace..

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-04-05 15:11:57 +02:00
Daniel J Walsh e1ff94ad48
Fix cross compilation code for other platforms
When trying to vendor into containers/image we found issues
with cross platform compilation.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-03-20 08:36:26 -04:00
Daniel J Walsh 877c68cba0
Move pkg/util default storage functions from libpod to containers/storage
In an effort to remove cross vendoring, trying to fix buildah from importing
from libpod.  I beleive these libraries make more sense in containers/storage
then in libpod.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-03-19 08:33:42 -04:00
Victor Vieux d648708d02 remove utils.go
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-03-10 21:06:27 +00:00
Michael Crosby 36c3614fdd Move runtime and container into sub pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-03-09 23:03:40 -07:00
Alexander Larsson d8c888b3f8 Drop EofReader
This is not used any more

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-14 13:46:21 +01:00
Solomon Hykes 6393c38339 Move the canonical run configuration objects to a sub-package
* Config is now runconfig.Config
    * HostConfig is now runconfig.HostConfig
    * MergeConfig is now runconfig.Merge
    * CompareConfig is now runconfig.Compare
    * ParseRun is now runconfig.Parse
    * ContainerConfigFromJob is now runconfig.ContainerConfigFromJob
    * ContainerHostConfigFromJob is now runconfig.ContainerHostConfigFromJob

This facilitates refactoring commands.go and shrinks the core.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-02-11 20:18:46 -08:00
Solomon Hykes e6e320acc7 pkg/opts: a collection of custom value parsers implementing flag.Value
This facilitates the refactoring of commands.go.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-02-11 19:59:52 -08:00
Solomon Hykes 3ecd8ff0c8 New package `nat`: utilities for manipulating the text description of network ports.
This facilitates the refactoring of commands.go

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-02-11 16:51:01 -08:00
Alexander Larsson bcaf6c2359 Add Put() to graphdriver API and use it
This makes all users of Put() have a corresponding call
to Get() which means we will be able to track whether
any particular ID is in use and if not unmount it.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-01-21 11:25:37 +01:00
Michael Crosby 1d8455e683 Move RootIsShared to lxc driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-01-17 17:42:22 -08:00
Tianon Gravi 8f3b8f3835 Run 'gofmt -s -w' 2014-01-06 22:14:35 -07:00
Solomon Hykes a009d4ae8d Move utility package 'namesgenerator' to pkg/namesgenerator 2013-12-23 23:45:18 +00:00
Victor Vieux 99e4f56353 Merge pull request #2930 from creack/docker-osx
Docker client on OSX
2013-12-03 15:27:21 -08:00
Guillaume J. Charmes 74ea136a49 Move reflink to os dependent file. OSX docker client fully functionnal. 2013-11-27 19:23:48 -08:00
Guillaume J. Charmes 1ba11384bf Refactor Opts 2013-11-26 17:46:06 +00:00
Michael Crosby e69bbd239e Merge branch 'master' into 0.6.5-dm-plugin 2013-11-22 14:06:59 -08:00
Guillaume J. Charmes 1f9223a7c2
Use a constant for PortSpecTemplate + display the template in the CmdRun help 2013-11-22 12:00:34 -08:00
Guillaume J. Charmes 476559458d Reformatting parseRun and partParse 2013-11-22 11:58:02 -08:00
Guillaume J. Charmes 7cf60da388
Merge branch 'master' into shykes-0.6.5-dm-plugin
Conflicts:
	utils.go
	utils_test.go
2013-11-14 14:02:44 -08:00
Michael Crosby 629c6e3649 Merge pull request #2445 from alexlarsson/fix-shared-root-from-dm
Fix lxc start for shared root filesystems
2013-11-14 11:20:53 -08:00
Solomon Hykes 01990b65a3 Move Change to the archive package 2013-11-07 16:46:47 -08:00
Solomon Hykes 9ae4bcaaf8 Move Change to the archive package, and fix a leftover merge in
Container.Inject()
2013-11-08 00:45:07 +00:00
Solomon Hykes f1127b9308 gofmt 2013-11-07 23:58:03 +00:00
Solomon Hykes 165d1bdbc0 Merge branch 'master' into 0.6.5-dm-plugin
Conflicts:
	container.go
	runtime.go
2013-11-07 23:26:52 +00:00
Victor Vieux 49c4231f07 fix mergeConfig with new ports 2013-11-07 14:31:25 -08:00
Alexander Larsson 157d99a727 lxc: Work around lxc-start need for private mounts
lxc-start requires / to be mounted private, otherwise the changes
it does inside the container (both mounts and unmounts) will propagate
out to the host.

We work around this by starting up lxc-start in its own namespace where
we set / to rshared.

Unfortunately go can't really execute any code between clone and exec,
so we can't do this in a nice way. Instead we have a horrible hack that
use the unshare command, the shell and the mount command...
2013-11-06 20:43:06 +01:00
Solomon Hykes 36c7a7ae94 Partial merge of devmapper/ in order to integrate it as a backend
plugin.

The merge is inert, in other words the devmapper code is not called
and the primary aufs backend is untouched.
2013-11-01 04:24:17 +00:00
Victor Vieux 7f07ae9e42 check port is valid 2013-10-31 19:00:14 -07:00
Michael Crosby 8227ea35cf Assign id as name when all else fails 2013-10-30 18:31:18 -07:00
Michael Crosby 746ba127bf Hotfix: Migrate public mappings after upgrade 2013-10-30 08:15:12 -07:00
Michael Crosby 0d2924408b Add -name for docker run
Remove docker link
Do not add container id as default name
Create an auto generated container name if not
specified at runtime.
2013-10-28 18:09:08 -07:00
Alexander Larsson d063c8d941 Move ListOps to utils submodule
This will be needed for later use in docker-init without a docker
dependency
2013-10-25 15:13:24 -07:00
Michael Crosby 1cbdaebaa1 Add links for container relationships and introspection 2013-10-25 15:13:24 -07:00
Guillaume J. Charmes e9ee860c91
Merge branch 'master' into dm
Conflicts:
	Dockerfile
	buildfile.go
	container.go
	hack/make/test
	runtime_test.go
	utils/utils.go
2013-10-18 12:38:29 -07:00
Victor Vieux f84dc1e908 add missing error check 2013-10-03 22:33:00 +00:00
Alexander Larsson d263aa6ca9 RootIsShared: Fix root detection
Column 4 is the mount position, column 3 will not always be
"/" for the root. On one of my system its "/root".
2013-09-26 15:09:33 +00:00
Alexander Larsson cda8754013 Add CopyFile that can use btrfs reflinks if availible 2013-09-26 15:09:32 +00:00
Alexander Larsson d478a4bb54 RootIsShared() - Fix array out of bounds error
This happened for me on the last (empty) line, but better safe than sorry
so we make the check general.
2013-09-26 15:09:32 +00:00
Alexander Larsson e40f5c7cb9 lxc: Work around lxc-start need for private mounts
lxc-start requires / to be mounted private, otherwise the changes
it does inside the container (both mounts and unmounts) will propagate
out to the host.

We work around this by starting up lxc-start in its own namespace where
we set / to rprivate.

Unfortunately go can't really execute any code between clone and exec,
so we can't do this in a nice way. Instead we have a horrible hack that
use the unshare command, the shell and the mount command...
2013-09-26 15:09:32 +00:00
Victor Vieux 5bd0437eed abord build if mergeConfig returns an error and fix duplicate error message 2013-09-20 12:46:24 +00:00
Michael Crosby 551092f9c0 Add lxc-conf flag to allow custom lxc options 2013-08-22 16:05:21 +00:00
Marco Hennings 319988336c Add workdir support for the Buildfile
For consistency the Buildfile should have the option to
set the working directory.

Of course that is one option more to the buildfile,
so please tell me if we really want this to happen.
2013-08-18 20:30:19 +02:00
Victor Vieux 066873ebd2 rebase master 2013-07-24 14:38:40 +00:00
Victor Vieux a0eec14c7d fix overwrites EXPOSE 2013-07-19 02:47:35 +00:00
Victor Vieux 1a226f0e28 add VolumesFrom to MergeConfig, and test 2013-07-17 21:06:46 +00:00