Commit Graph

784 Commits

Author SHA1 Message Date
c77458bef6 Update libcontainer to 1597c68f7b941fd97881155d7f077852e2914e7b
This commit contains changes for docker:
* user.GetGroupFile to user.GetGroupPath docker/libcontainer#301
* Add systemd support for OOM docker/libcontainer#307
* Support for custom namespaces docker/libcontainer#279, docker/libcontainer#312
* Fixes #9699 docker/libcontainer#308

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 50905a6d6ce2fdd1ab0c33ec0b7a26895e0cbeea
Component: engine
2014-12-23 12:10:03 -08:00
e9f43223c9 Merge pull request #9765 from thaJeztah/improve-error-message-3036
Improve error message for conflicting container name.
Upstream-commit: 034ba8b88fdcc3d5100ae0d2edc914673b15a2f4
Component: engine
2014-12-22 18:02:48 -08:00
7a5549d8ea Remove unused function from vfs storage driver
Signed-off-by: Pierre Wacrenier <pierre.wacrenier@gmail.com>
Upstream-commit: c1e04fbb150d71c243d505b79136108cb2f31f5c
Component: engine
2014-12-23 00:36:20 +01:00
cc053abec3 Improve error message for conflicting container name.
This changes the error message that is returned by the daemon when
a container-name already exists.

The old message suggests that containers can be renamed, which is
currently not possible.

To prevent confusion, the part "(or rename)" is removed from
the error-message.

Message before this change;

    FATA[0000] Error response from daemon: Conflict, The name foobar is already assigned to 728ac36fb0ab. You have to delete (or rename) that container to be able to assign foobar to a container again.

Message after this change;

    FATA[0000] Error response from daemon: Conflict. The name 'foobar' is already in use by container 728ac36fb0ab. You have to delete that container to be able to reuse that name.

Relates to: https://github.com/docker/docker/issues/3036

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: aa9c9569c29e3696c9427d2d66341c95fe076e4f
Component: engine
2014-12-22 09:59:08 +01:00
d0893cb64b Tidy driver.go/LinkContainers
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
Upstream-commit: 38a595aec561b8a7b4325b6c1c4efd1b0b8e89c0
Component: engine
2014-12-21 13:42:02 +10:00
4b105a7583 Create tests for pkg/iptables
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
Upstream-commit: 0da92633b4161ed1f8babe5ec4a9fe98257d34b5
Component: engine
2014-12-21 12:57:32 +10:00
ae55b92633 Create DOCKER forward chain on driver init
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
Upstream-commit: 2865373894f1532fa725481e8f04db4a5d7a0aa8
Component: engine
2014-12-21 12:57:32 +10:00
c720d69487 Move per-container forward rules to DOCKER chain
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
Upstream-commit: cc89b30d35edc02fc598a0b26fe7a1ed002238e4
Component: engine
2014-12-21 12:57:32 +10:00
c7d1f45ca3 Merge pull request #9233 from inatatsu/fix-pkg-units-size-for-gccgo
Fix to avoid a compile error due to float to int truncation with GCCGO
Upstream-commit: 2acb856dff848bd69c5e971f6352854a26362164
Component: engine
2014-12-18 18:33:01 -08:00
625be9e469 Merge pull request #8827 from jlhawn/build_implied_from_scratch
Make `FROM scratch` a special cased 'no-base' spec
Upstream-commit: 610842f906a942e9784bc16c201860dc89ba19ba
Component: engine
2014-12-18 18:21:16 -05:00
98bb6eba72 Make FROM scratch a special cased 'no-base' spec
There has been a lot of discussion (issues 4242 and 5262) about making
`FROM scratch` either a special case or making `FROM` optional, implying
starting from an empty file system.

This patch makes the build command `FROM scratch` special cased from now on
and if used does not pull/set the the initial layer of the build to the ancient
image ID (511136ea..) but instead marks the build as having no base image. The
next command in the dockerfile will create an image with a parent image ID of "".
This means every image ever can now use one fewer layer!

This also makes the image name `scratch` a reserved name by the TagStore. You
will not be able to tag an image with this name from now on. If any users
currently have an image tagged as `scratch`, they will still be able to use that
image, but will not be able to tag a new image with that name.

Goodbye '511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158',
it was nice knowing you.

Fixes #4242

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 8936789919c5c8004f346f44a3452d1521818b60
Component: engine
2014-12-18 14:03:38 -08:00
9c05f0eaf9 Refactor to optimize storage driver ApplyDiff()
To avoid an expensive call to archive.ChangesDirs() which walks two directory
trees and compares every entry, archive.ApplyLayer() has been extended to
also return the size of the layer changes.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 35a22c9e12c05e2a0a205964702ced78ea39d7a1
Component: engine
2014-12-17 21:54:23 -08:00
6b6aa4bf22 Merge pull request #9643 from LK4D4/fix_vet_errors
Fix vet errors
Upstream-commit: 17cacf3326edde6d177e12132f74fc0174bda1d2
Component: engine
2014-12-16 12:04:15 -08:00
55ec358b5c Merge pull request #9610 from duglin/Issue9602
Wrap strings that could look like ints in quotes
Upstream-commit: eea9f0e781f5a2cc438aad11315253b6fb42ed9e
Component: engine
2014-12-16 12:02:26 -08:00
2187cf5beb Merge pull request #9122 from dqminh/debug-huge-expose
Expose a large number of ports should not slow down builder
Upstream-commit: a76f7c6ec32431b6cbf286d9be86f7dde0b3ac0d
Component: engine
2014-12-16 10:03:31 -08:00
ecd4852381 Fix volumes-from/bind-mounts passed in on start
Fixes #9628
Slightly reverts #8683, HostConfig on start is _not_ deprecated.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: d44c9f91472eb3df4c38c669134df04b2ccf9953
Component: engine
2014-12-15 16:51:15 -05:00
ba3cc4bafb Wrap strings that could look like ints in quotes
When we use the engine/env object we can run into a situation where
a string is passed in as the value but later on when we json serialize
the name/value pairs, because the string is made up of just numbers
it appears as an integer and not a string - meaning no quotes.  This
can cause parsing issues for clients.

I tried to find all spots where we call env.Set() and the type of the
name being set might end up having a value that could look like an int
(like author). In those cases I switched it to use env.SetJson() instead
because that will wrap it in quotes.

One interesting thing to note about the testcase that I modified is that
the escaped quotes should have been there all along and we were incorrectly
letting it thru. If you look at the metadata stored for that resource you
can see the quotes were escaped and we lost them during the serialization
steps because of the env.Set() stuff.  The use of env is probably not the
best way to do all of this.

Closes: #9602

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: d942c59b696d16def85f6b65ae65c176f66a5562
Component: engine
2014-12-15 05:10:49 -08:00
98f1f432b6 Merge pull request #9625 from LK4D4/fix_race_in_sec_opts
Fix race condition between parseSecurityOpt and container.Mount
Upstream-commit: b66abaa291ae9de714d15371b3f7e7dcd58853ce
Component: engine
2014-12-12 11:34:59 -08:00
149e33e015 Fix vet errors about json tags for unexported fields
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: c7ff6bf69149bc5892633d95ebfacaf3ad36a008
Component: engine
2014-12-12 11:01:46 -08:00
bebcb13002 Fix vet errors about formatting directives
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a7ae7fed7311551975d2bccb7417c328be3ea478
Component: engine
2014-12-12 10:58:56 -08:00
e0b22078ad Fix vet errors in aufs.go about Lock by value
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 2540765ddc8889e2757f9ccfbfe852074b61601c
Component: engine
2014-12-12 10:46:09 -08:00
7886e44221 Fix vet errors about unkeyed fields
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: e7d086c2be41dfedfa5f2fb0c437eb5bbf6f2f5d
Component: engine
2014-12-12 10:44:59 -08:00
1f4328ca63 Report number of times that docker has auto-restarted a container
Fixes #9469.

Signed-off-by: Rémy Greinhofer <remy.greinhofer@livelovely.com>
Upstream-commit: 8f8d24cb1c762e74833bbb9b6e2b58438b42d36b
Component: engine
2014-12-12 09:40:11 -08:00
1018b62fc8 Merge pull request #9599 from LK4D4/no_release_non_own
Don't try release network in non-private modes
Upstream-commit: 14a82de6fa1c3a2fa2e2f136b07be66b47445cdb
Component: engine
2014-12-11 18:25:00 -08:00
d98b25173b Fix race condition between parseSecurityOpt and container.Mount
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: 862952c8d4d3df69f35535af5ce5a079b5fe739e
Component: engine
2014-12-11 17:22:59 -08:00
62c0414eca Merge pull request #9258 from rhvgoyal/transaction-id-improvements
devmapper fix usage of pool transaction id 
Upstream-commit: 74bbb935715a3f384a4a3a527053af5419f5a72e
Component: engine
2014-12-11 12:58:18 -05:00
d44cc14dce Don't try release network in non-private modes
Fixes #9594

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: b3ade99a7822f4edb21400a1003ff0e3893caa38
Component: engine
2014-12-10 11:59:32 -08:00
6ca414da06 User should get error message on wrong config
closes #9501

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: 8dcbd6ab636e756736cef5408710ff97fd207370
Component: engine
2014-12-09 21:52:07 +00:00
bb5a33c82a Merge pull request #9356 from cc272309126/fix-exec-paused-container
Fix the issue that when docker exec a paused container, it will always
Upstream-commit: bb24f99d741cd8d6a8b882afc929c15c633c39cb
Component: engine
2014-12-09 11:01:44 -08:00
281b2a944f Merge pull request #9447 from ashahab-altiscale/7687-lxc-cap-add-cap-drop
LXC CAP ADD CAP DROP IN TEMPLATE
Upstream-commit: 86efd1a1022b900951459d5eba2eb81caacc770a
Component: engine
2014-12-09 10:35:52 -08:00
3890e00172 Running a container that links to a container with --net host
should throw an error.

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Upstream-commit: 6743be44ca9006cb7ca26cd3d8410877727a6313
Component: engine
2014-12-08 11:33:18 -08:00
be5e940362 Merge pull request #9489 from crosbymichael/info-root
Return docker's root dir in docker -D info
Upstream-commit: 12252e39a0abc188e1cd1fe9e921eef967308e1c
Component: engine
2014-12-08 09:05:00 -08:00
84a6c7d576 LXC CAP ADD CAP DROP IN TEMPLATE
Added cap-drop and cap-add in lxc template
Docker-DCO-1.1-Signed-off-by: Abin Shahab <ashahab@altiscale.com> (github: ashahab-altiscale)
Upstream-commit: fdf745768350d2068aecd34734b38a2c27810132
Component: engine
2014-12-05 23:08:22 +00:00
0703a67ce9 Return docker's root dir in docker -D info
This adds the docker daemon's root directory to docker info when running
in debug mode.  This allows the user to view the root directory where
docker is writing and storing state.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 654da4e151c449725b6996d47b7ff33767e87da9
Component: engine
2014-12-05 12:13:25 -08:00
996111b8d3 Merge pull request #9272 from SvenDowideit/pr_out_try_out_a_different_phrase_for_icc
Try out a different phrase for --icc
Upstream-commit: 8dfcbf62edb2853176eb3f5cf077dae68f2e85c3
Component: engine
2014-12-05 16:22:51 +10:00
ac96967ba9 Use consistent ApplyLayer in overlayfs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: f47d6b9b9de8c567e9e42e12243cbcce99a7bfc7
Component: engine
2014-12-04 12:03:44 -08:00
2b487e0de2 Fix the issue when docker exec a paused container, it will always hang.
Add the test case of this issue.

Docker-DCO-1.1-Signed-off-by: Chen Chao <cc272309126@gmail.com> (github: cc272309126)
Upstream-commit: 1bb02117db80e75f406f6c63d8d50680c1569019
Component: engine
2014-12-05 03:10:44 +08:00
e1ce0e0de9 Merge pull request #9089 from cpuguy83/8942_create_volumes_on_create
Initialize volumes when container is created
Upstream-commit: 67fda331973fdd23f3da79588ea899dc577f46e8
Component: engine
2014-12-03 15:42:09 -08:00
576cfafbf2 Merge pull request #9426 from lhuard1A/overlay_rename
Rename overlayfs to overlay
Upstream-commit: 5d49d2bb7a3bafcd1481a05d56ebc39ecd394393
Component: engine
2014-12-03 10:57:42 -08:00
d335495a31 devmapper: Use transactions during device deletion
Use transaction logic during device deletion and do rollback if transaction
is not complete. Following is the sequence of events.

- Open transaction and save to metafile
- Delete device from pool
- Delete device metadata file from disk
- Close Transaction

If docker crashes without closing transaction then rollback will take
place upon next docker start.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 17b75a21a667a27a9a27565ab282cd615dbdb66e
Component: engine
2014-12-03 13:06:43 -05:00
18c76d6b93 devmapper: Use transaction mechanism during device or snap device creation
Finally this patch uses the notion of transaction for device or snapshot
device creation. 

Following is sequence of event.

- Open a trasaction and save details in a file.
- Create a new device/snapshot device
- If a new device id is used, refresh transaction with new device id details.
- Create device metadata file
- Close transaction.

If docker crashes anywhere in between without closing transaction, then
upon next start, docker will figure out that there was a pending transaction
and it will roll back transaction. That is it will do following.

- Delete Device from pool
- Delete device metadata file
- Remove transaction file to mark no transaction is pending.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: c115c4aa45ba82f27859b0afba5724d437857879
Component: engine
2014-12-03 13:06:43 -05:00
f802074502 devmapper: Find a free device Id to use for device creation
Finally, we seem to have all the bits to keep track of all used device
Ids and find a free device Id to use when creating a  new device. Start
using it.

Ideally we should completely move away from retry logic when pool returns
-EEXISTS. For now I have retained that logic and I simply output a warning.
When things are stable, we should be able to get rid of it.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: e28a419e1197bf50bbb378b02f0226c3115edeaa
Component: engine
2014-12-03 13:06:43 -05:00
c3a04ca795 devmapper: Open code createDevice() and createSnapDevice()
Open code createDevice() and createSnapDevice() and move all the logic
in the caller.

This is a sheer code reorganization so that all device Id allocation
logic is in one function. That way in case of erros, one can easily
cleanup and mark device Id free again. (Later patches benefit from
it).

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 14d0dd855ee1e7cd1a3185c3d5a00e7afccb5c43
Component: engine
2014-12-03 13:06:43 -05:00
a3ad44f760 devmapper: Provide a helper function getNextDeviceId()
Right now we are accessing devices.NextDeviceId directly and also 
incrementing it at various places.

Instead provide a helper function which is responsile for
incrementing NextDeviceId and return next deviceId. 

This is just code structuring. This will help later once we
convert this function to find a free device Id and it goes
through a bitmap of used/free device Ids.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: a44c23fe6604d1de59c64bbb9dc234c7c3dbede9
Component: engine
2014-12-03 13:06:43 -05:00
336b3bbd52 devmapper: Construct initial device Id map from device meta files
When docker starts, build a used/free Device Id map from the per
device meta files we already have. These meta files have the data
which device Ids are in use. Parse these files and mark device as
used in the map.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 39dc7829dea87d4be8e6e9b2a598fb354ebf4ba0
Component: engine
2014-12-03 13:06:43 -05:00
622c433bcb devmapper: Keep track of used device Ids in a bitmap
Currently devicemapper backend does not keep track of used device Ids in
the pool. It tries a device Id and if that device Id exists in pool, it
tries with a different Id and keeps on doing this in a loop till it succeeds.

This worked fine so far but now we are moving to transaction based
device creation and deletion. We will keep deviceId information in 
transaction which will be rolled back if docker crashed before transaction
was complete.

If we store a deviceId in transaction and later figure out it already
existed in pool and docker crashed, then we will rollback and remove
that existing device Id from pool (which we should not have).

That means, we should know free device Id in pool in advance before
we put that device Id in transaction.

Hence this patch creates a bitmap (one bit each for a deviceId), and
sets the bit if device Id is used otherwise resets it. This patch
is just preparing the ground right now. Actual usage will follow
in later patches.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 4d39e056aac2fadffcb8560101f3c31a2b7db3ae
Component: engine
2014-12-03 13:06:43 -05:00
b4dc28ba46 devmapper: Use a common delete function for all device deletion operation
Right now setupBaseImage() uses deleteDevice() to delete uninitialized
base image while rest of the code uses DeleteDevice(). Change it and
use a common function everywhere for the sake of uniformity.

I can't see what harm can be done by doing little extra locking done
by DeleteDevice().

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 359a38b26a164f430c79fe542babb77c6e48dcc3
Component: engine
2014-12-03 13:06:43 -05:00
63f43eb974 devmapper: Rename NewTransactionId to OpenTransactionId
Very soon we will have the notion of an open transaction and keep its
details in a metafile.

When a new transaction is opened, we allocate a new transaction Id, 
do the device creation/deletion and then we will close the transaction.

I thought that OpenTransactionId better represents the semantics of
transaction Id associated with an open transaction instead of NewtransactionId.

This patch just does the renaming. No functionality change.

I have also introduced a structure "Transaction" which will keep all
the details associated with a transaction. Later patches will add more
fields in this structure.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: f078bcd8e50913fd8b05022ebd047c5a1f2e3d52
Component: engine
2014-12-03 13:06:43 -05:00
d225e227dc devmapper: Allocate new transaction Id using current transaction Id
Currently new transaction Id is created using allocateTransactionId()
function. This function takes NewTransactionId and bumps up by one 
to create NewTransactionId.

I think ideally we should be bumping up devices.TransactionId by 1
to come up with NewTransactionId. Because idea is that devices.TransactionId
contains the current pool transaction Id and to come up with a new
transaction Id bump it up by one.

Current code is not wrong as we are keeping NewTransactionId and
TransactionId in sync. But it will be more direct if we look at
devices.TransactionId to come up with NewTransactionId. That way
we don't have to even initialize NewTransactionId during startup
as first time somebody wants to do a transaction, it will be
allocated fresh.

So simplify the code a bit. No functionality change.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 7b0a1b814b8f13e30df466dd66c3fdc2114eac28
Component: engine
2014-12-03 13:06:43 -05:00
f0bbf70516 devmapper: Remove unnecessary condition check in updatePoolTransactionId()
Currently updatePoolTransactionId() checks if NewTransactionId and
TransactionId are not same only then update the transaction Id in pool. This
check is redundant. Currently we call updatePoolTransactionId() only from
two places and both of these first allocate a new transaction Id.

Also updatePoolTransactionId() should only be called after allocating
new transaction Id otherwise it does not make any sense.

Remove the redundant check and reduce confusion.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 6d347aeb6984ebdcb1051212ab3103880ef69ab0
Component: engine
2014-12-03 13:06:43 -05:00