Commit Graph

391 Commits

Author SHA1 Message Date
6021acc699 Fix overlay and user namespace permissions
All underlay dirs need proper remapped ownership. This bug was masked by the
fact that the setupInitLayer code was chown'ing the dirs at startup
time. Since that bug is now fixed, it revealed this permissions issue.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 191cefbaca45ba86341379d09d2f75d5fc1868fb
Component: engine
2015-12-08 14:28:28 -05:00
8c2653fb9a fix Put without Get in aufs
this Patch is ported from 3916561619d45a3d8ca17dfa467149824111023a

Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Upstream-commit: 451f7517733087a8629fe20894b6c10a63bb155e
Component: engine
2015-12-03 22:22:25 +08:00
5e25f840c3 Fix Put without Get in devicemapper
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Upstream-commit: f7bdb973578a08a5012c741e4ebb262d2dd81165
Component: engine
2015-12-03 22:22:25 +08:00
b17c4f91f6 devmapper: Log start and end of filesystem creation
ext4 filesystem creation can take a long time on 100G thin device and
systemd might time out and kill docker service. Often user is left thinking
why docker is taking so long and logs don't give any hint. Log an info
message in journal for start and end of filesystem creation. That way
a user can look at logs and figure out that filesystem creation is
taking long time.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: a489e685c0d17455463945316cfe366e4e65dca6
Component: engine
2015-12-01 13:05:46 +00:00
e105a29374 Update daemon and docker core to use new content addressable storage
Add distribution package for managing pulls and pushes. This is based on
the old code in the graph package, with major changes to work with the
new image/layer model.

Add v1 migration code.

Update registry, api/*, and daemon packages to use the reference
package's types where applicable.

Update daemon package to use image/layer/tag stores instead of the graph
package

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 4352da7803d182a6013a5238ce20a7c749db979a
Component: engine
2015-11-24 09:40:25 -08:00
f3cdb6f05f Merge pull request #17974 from anusha-ragunathan/fsMagic
Fix devmapper backend in docker info
Upstream-commit: 1ecb9a40db176489ac8760251abe56e560bc848d
Component: engine
2015-11-17 11:44:48 -08:00
07479c944e Merge pull request #16452 from rhatdan/btrfs-selinux
Relabel BTRFS Content on container Creation
Upstream-commit: 4dda67b8014e71508e992c736febc5c45c53c095
Component: engine
2015-11-17 11:03:40 -08:00
c9ee279a92 Merge pull request #17479 from coolljt0725/show_warning
Show warning when user specify dm.basesize for already initialized devicemapper driver
Upstream-commit: cf824d974922ae7ad55548b3f0050a2bb0e29aa2
Component: engine
2015-11-15 08:51:33 +01:00
666ae52a68 Fix devmapper backend in docker info
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: fdc2641c2b329c48cf1d1c8c0b806bec8784b3e0
Component: engine
2015-11-13 21:05:47 -08:00
c077545d83 Relabel BTRFS Content on container Creation
This change will allow us to run SELinux in a container with
BTRFS back end.  We continue to work on fixing the kernel/BTRFS
but this change will allow SELinux Security separation on BTRFS.

It basically relabels the content on container creation.

Just relabling -init directory in BTRFS use case. Everything looks like it
works. I don't believe tar/achive stores the SELinux labels, so we are good
as far as docker commit.

Tested Speed on startup with BTRFS on top of loopback directory. BTRFS
not on loopback should get even better perfomance on startup time.  The
more inodes inside of the container image will increase the relabel time.

This patch will give people who care more about security the option of
runnin BTRFS with SELinux.  Those who don't want to take the slow down
can disable SELinux either in individual containers or for all containers
by continuing to disable SELinux in the daemon.

Without relabel:

> time docker run --security-opt label:disable fedora echo test
test

real    0m0.918s
user    0m0.009s
sys    0m0.026s

With Relabel

test

real    0m1.942s
user    0m0.007s
sys    0m0.030s

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

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Upstream-commit: 1716d497a420f0cd4e53a99535704c6d215e38c7
Component: engine
2015-11-11 14:49:27 -05:00
abd797dbbd devmapper: Switch to xfs as default filesystem if supported
If platform supports xfs filesystem then use xfs as default filesystem 
for container rootfs instead of ext4. Reason being that ext4 is pre-allcating
lot of metadata (around 1.8GB on 100G thin volume) and that can take long
enough on AWS storage that systemd times out and docker fails to start.

If one disables pre-allocation of ext4 metadata, then it will be allocated
when containers are mounted and we will have multiple copies of metadata
per container. For a 100G thin device, it was around 1.5GB of metadata
per container.

ext4 has an optimization to skip zeroing if discards are issued and
underlying device guarantees that zero will be returned when discarded
blocks are read back. devicemapper thin devices don't offer that guarantee
so ext4 optimization does not kick in. In fact given discards are optional
and can be dropped on the floor if need be, it looks like it might not be
possible to guarantee that all the blocks got discarded and if read back
zero will be returned.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 07ff17fb850e5ddae6f38cc21776ebb9b1690f3e
Component: engine
2015-11-11 12:07:35 -05:00
edb4695814 devmapper: Warn if user specified a filesytem and base device already has fs
If user wants to use a filesystem it can be specified using dm.fs=<filesystem>
option. It is possible that docker already had base image and a filesystem
on that. Later if user wants to change file system using dm.fs= option
and restarts docker, that's not possible. Warn user about it.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 83a34e000b2332d9a1b4214a77fae021ed144acb
Component: engine
2015-11-11 12:07:35 -05:00
199c5fdeef Merge pull request #16774 from tonistiigi/15643-aufs-plnk
Copy aufs hardlinks to top layer
Upstream-commit: 10667253951a783785d3236192428a5decca3fef
Component: engine
2015-11-11 07:59:41 +01:00
dd6061632b Show warning when user specify dm.basesize for already initialized devicemapper drive
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: e035d272232890cd01b5eabc1081041032affdc0
Component: engine
2015-11-10 14:50:19 +08:00
2f262fa249 Merge pull request #17431 from vdemeester/hope-it-does-not-broke-everything-again
Another try at dockerversion placeholder for library import
Upstream-commit: 58b270c338e831ac6668a29788c72d202f9fc251
Component: engine
2015-11-09 13:15:50 -08:00
48001c30bb dockerversion placeholder for library import
- Add a *version* file placeholder.
- Update autogen and builds to use it and an autogen build flag

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 8054a303870b81eebe05e38261c1b68197b68558
Component: engine
2015-11-09 19:32:46 +01:00
8fd542a1df Merge pull request #17757 from rhvgoyal/log-blkid-failure
devmapper: Provide more error information if blkid fails
Upstream-commit: 10df5647bd5c9e5946412bd58fefb5323f67bc49
Component: engine
2015-11-07 09:16:14 -05:00
a401f0d13c Merge pull request #17576 from Microsoft/10662-graphtest
Windows: Fix daemon\graphdriver\graphtest
Upstream-commit: 1ba280a8db8456649b661e292d687f1be7ed3468
Component: engine
2015-11-06 15:13:31 -08:00
eaec8fb727 devmapper: Provide more error information if blkid fails
Right now if blkid fails we are just logging a debug message and don;t return
the actual error to caller. Caller gets the error message that thin pool
base device UUID verification failed and it might give impression that thin
pool changed. But that's not the case. Thin pool is in such a state that we
could not even query the thin device UUID. Retrun error message appropriately
to make situation more clear.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 2c8b7c597ae43e28887a52a9fcb12273fe7d8797
Component: engine
2015-11-06 08:21:20 -05:00
ef88e7ace2 Remove LXC support.
The LXC driver was deprecated in Docker 1.8.
Following the deprecation rules, we can remove a deprecated feature
after two major releases. LXC won't be supported anymore starting on Docker 1.10.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 3b5fac462d21ca164b3778647420016315289034
Component: engine
2015-11-05 17:09:57 -05:00
8e6e6234af Windows: Fix daemon\graphdriver\graphtest
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 876496738116611d350a3ce196ad836291beb1fd
Component: engine
2015-10-31 21:14:18 -07:00
cc55863497 Revert "dockerversion placeholder for library-import"
This reverts commit d5cd032a86617249eadd7142227c5355ba9164b4.

Commit caused issues on systems with case-insensitive filesystems.
Revert for now

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: b78ca243d9fc25d81c1b50008ee69f3e71e940f6
Component: engine
2015-10-27 21:23:53 -04:00
4d261096ec dockerversion placeholder for library-import
- Move autogen/dockerversion to version
- Update autogen and "builds" to use this package and a build flag

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: d5cd032a86617249eadd7142227c5355ba9164b4
Component: engine
2015-10-27 20:36:07 +01:00
f6f1715608 devmapper: Drop devices lock before returning from function
cleanupDeleted() takes devices.Lock() but does not drop it if there are
no deleted devices. Hence docker deadlocks if one is using deferred
device deletion feature. (--storage-opt dm.use_deferred_deletion=true).

Fix it. Drop the lock before returning.

Also added a unit test case to make sure in future this can be easily
detected if somebody changes the function.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 2f16895ee94848e2d8ad72bc01968b4c88d84cb8
Component: engine
2015-10-19 17:51:17 -04:00
61e523114f Merge pull request #16303 from coolljt0725/add_docker_info_show_base_size
Add docker info show base filesystem size of container/image when use devicemapper
Upstream-commit: 5ecbc9747fab243136402ea78d65e928e6d4678b
Component: engine
2015-10-13 14:43:52 +02:00
ea754befe4 Copy aufs hardlinks to top layer
Show warning if old method is used.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: ef05b83417e32f269daf798307adcf07fe6ef13f
Component: engine
2015-10-12 20:44:32 -07:00
eb67a37877 Calculate hash based image IDs on pull
Generate a hash chain involving the image configuration, layer digests,
and parent image hashes. Use the digests to compute IDs for each image
in a manifest, instead of using the remotely specified IDs.

To avoid breaking users' caches, check for images already in the graph
under old IDs, and avoid repulling an image if the version on disk under
the legacy ID ends up with the same digest that was computed from the
manifest for that image.

When a calculated ID already exists in the graph but can't be verified,
continue trying SHA256(digest) until a suitable ID is found.

"save" and "load" are not changed to use a similar scheme. "load" will
preserve the IDs present in the tar file.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 504e67b867865a2835e8002c01087a2cfd7bfd0e
Component: engine
2015-10-12 10:51:28 -07:00
89e0fe4844 Comment: add some lines back
Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: a066b94ef0b4e7d90a6418429b056883e407b665
Component: engine
2015-10-12 19:34:58 +08:00
fa4c923057 Add docker info show base filesystem size of container/image when use devicemapper
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 5c374c7137c3749bff7f85d3fad94290f63034db
Component: engine
2015-10-10 22:52:05 +08:00
93c2a19d83 Add user namespace (mapping) support to the Docker engine
Adds support for the daemon to handle user namespace maps as a
per-daemon setting.

Support for handling uid/gid mapping is added to the builder,
archive/unarchive packages and functions, all graphdrivers (except
Windows), and the test suite is updated to handle user namespace daemon
rootgraph changes.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 442b45628ee12ebd8e8bd08497896d5fa8eec4bd
Component: engine
2015-10-09 17:47:37 -04:00
e0d971daa6 Do not probe plugins for graph init unless -s
When `-s` is not specified, there is no need to ask if there is a plugin
with the specified name.

This speeds up unit tests dramatically since they don't need to wait the
timeout period for each call to `graphdriver.New`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 3b16cb15b496edc3dc080560c7189e06e19c5343
Component: engine
2015-10-09 12:02:54 -04:00
6ec1436aba Merge pull request #16152 from chlunde/devmapper-mount-flags
Use pkg/mount to support more flags in dm.mountopt
Upstream-commit: 6d9a84bcd04cd178033309859eb7bf386a8db85d
Component: engine
2015-10-08 16:02:50 -07:00
57e2d9f131 Merge pull request #13777 from cpuguy83/graphdriver_extpoints
Create extpoint for graphdrivers
Upstream-commit: 4c55464dd3fbbecb0e67f9b33c54f62f3982b500
Component: engine
2015-10-08 13:46:42 -07:00
99f0bfa2a6 Merge pull request #15868 from crosbymichael/aufs-data
Add aufs data structure for added mount information
Upstream-commit: b3b9fe8c7730060c9f5a7c5081b773676fdef889
Component: engine
2015-10-08 11:17:20 -07:00
815dbb240f Merge pull request #16852 from estesp/overlay-cleanup
Simplify dir removal in overlay driver
Upstream-commit: 6654b0e05f663da394bac6ed846187bca90451f5
Component: engine
2015-10-08 08:44:50 -07:00
a6e3345892 Merge pull request #16823 from rhvgoyal/check-thin-pool
devmapper: Make sure device is a thin pool device
Upstream-commit: c3e5364813848616d2713083cb442760e62417e4
Component: engine
2015-10-08 11:27:53 -04:00
99dfae8822 Simplify dir removal in overlay driver
There is no need to call `os.Stat` on the driver filesystem path of a
container as `os.RemoveAll` already handles (properly) the case where
the path no longer exists.

Given the results of the stat() were not even being used,  there is no
value in erroring out because of the stat call failure, and worse, it
prevents daemon cleanup of containers in "Dead" state unless you re-create
directories that were already removed via a manual cleanup after a
failure.  This brings removal in overlay in line with aufs/devicemapper
drivers which don't error out if the filesystem path no longer exists.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 6ed11b53743668dba3bcf6ecef4e57a399d95569
Component: engine
2015-10-08 11:04:00 -04:00
8709c3083b Merge pull request #16780 from Microsoft/jjh/vfs-build-tags
Fix VFS build tags
Upstream-commit: 53d24291648f3c610ddb13e131a498e1d27ae676
Component: engine
2015-10-08 09:43:06 +02:00
a357665097 devmapper: Make sure device is a thin pool device
Right now we check for the existence of device but don't make sure it is
a thin pool device. We assume it is a thin pool device and call poolStatus()
on the device which returns an error EOF. And that error does not tell
anything.

So before we reach the stage of calling poolStatus() make sure we are working
with a thin pool device otherwise error out.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 6d2d0a74e8effe65175473352bf58fc4beda1718
Component: engine
2015-10-07 16:28:49 -04:00
c46b8dfd3a devmapper: Implement a goroutine to cleanup deleted devices
Start a goroutine which runs every 30 seconds and if there are deferred
deleted devices, it tries to clean those up.

Also it moves the call to cleanupDeletedDevices() into goroutine and
moves the locking completely inside the function. Now function does not
assume that device lock is held at the time of entry.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 87de04005d61ab986d70a31e3ac82ec92912df55
Component: engine
2015-10-06 17:37:21 -04:00
fb33696b35 devmapper: Keep track of number of deleted devices
Keep track of number of deleted devices and export this information through
"docker info".

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: d295dc66521e2734390473ec1f1da8a73ad3288a
Component: engine
2015-10-06 17:37:21 -04:00
7bb486d26e devmapper: Implement deferred deletion functionality
Finally here is the patch to implement deferred deletion functionality.
Deferred deleted devices are marked as "Deleted" in device meta file. 

First we try to delete the device and only if deletion fails and user has
enabled deferred deletion, device is marked for deferred deletion.

When docker starts up again, we go through list of deleted devices and
try to delete these again.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: d929589c1fc4538dcd1b2a7a3dc7d4afbdfa72fd
Component: engine
2015-10-06 17:37:21 -04:00
cd659bcc9c devmapper: Provide option to enabled deferred device deletion
Provide a command line option dm.use_deferred_deletion to enable deferred
device deletion feature. By default feature will be turned off.

Not sure if there is much value in deferred deletion being turned on
without deferred removal being turned on. So for now, this feature can
be enabled only if deferred removal is on.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 51e059e7e90f37848596a0b6ec83f7835e6e4131
Component: engine
2015-10-06 17:37:21 -04:00
3c327a4ced devmapper: construct used device ID map from device Hash map
Currently during startup we walk through all the device files and read
their device ID and mark in a bitmap that device id is used.

We are anyway going through all device files. So we can as well load all
that data into device hash map. This will save us little time when
container is actually launched later.

Also this will help with later patches where cleanup deferred device
wants to go through all the devices and see which have been marked for
deletion and delete these.

So re-organize the code a bit.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 6b8b4feaa165af630dd33423f0538a0b987703ae
Component: engine
2015-10-06 17:37:21 -04:00
a37c8bb04a devmapper: Move UUID setup and verification code in a function
Simplify setupBaseImage() even further. Move some more code in a separate
function. Pure code reorganization. No functionality change.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 0fcd485626f110bbf39e8a6b1edc11b4ac6f7065
Component: engine
2015-10-06 08:38:03 -04:00
b4d2c9486c devmapper: Move thin pool related checks in a function
Move thin pool related checks in a separate function. Pure code reorganization.
Makes reading code easier.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 69051ec0a58906e5252f902063ccead2075c8bed
Component: engine
2015-10-06 08:38:03 -04:00
0f1a89a462 devmapper: Move base device creation in separate function
This moves base device creation function in a separate function. Pure
code reorganization. Makes reading code little easier.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: efc1ddd7e3341124a2ebbb8a358f44754b32f310
Component: engine
2015-10-06 08:38:03 -04:00
98d72c0286 Fix VFS build tags
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 7db08b4e62555055031ad6228221dc8c11ebe6a2
Component: engine
2015-10-05 15:52:09 -07:00
1c5745b90e devmapper: Few code cleanups
This patch does three things. Following are the descriptions.

===
Create a separate function for delete transactions so that parent function
is little smaller.

Also close transaction if an error happens.
===
When docker is being shutdown, save deviceset metadata first before
trying to remove the devices. Generally caller gives only 10 seconds
for shutdown to complete and then kills it after that. So if some device
is busy, we will wait 20 seconds for it removal and never be able to save
metadata. So first save metadata and then deal with device removal.
===
Move issue discard operation in a separate function. This makes reading code
little easier.

Also don't issue discards if device is still open. That means devices is
still probably being used and issuing discards is not a good idea.

This is especially true in case of deferred deletion. We want to issue
discards when device is not open. At that time device can be deleted too.
Otherwise we will issue discards and deletion will actually fail. Later
we will try deletion again and issue discards again and deletion will
fail again as device is open and busy.

So this will ensure that discards are issued once when device is not open
and it can actually be deleted.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 482eca3099ad4bf3a7db62a31f88e2158cbbc933
Component: engine
2015-10-05 09:02:31 -04:00
d911d85df7 Merge pull request #16490 from Microsoft/10662-mtimefix
Fixed file modified time not changing on windows
Upstream-commit: 134fefbaa2b63e337a5ef247111bb5a2733809be
Component: engine
2015-10-02 12:06:03 -07:00