Commit graph

416 commits

Author SHA1 Message Date
Tibor Vass
56ef47e881 Merge pull request #16890 from runcom/perf-boost
rmi and build cache miss performance improvements
2015-10-21 16:00:25 -04:00
David Calavera
d6d60287ee Move volume name validation to the local driver.
Delegate validation tasks to the volume drivers. It's up to them
to decide whether a name is valid or not.
Restrict volume names for the local driver to prevent creating
mount points outside docker's volumes directory.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-10-21 12:28:26 -04:00
Antonio Murdaca
f9e81b40f4 daemon: faster image cache miss detection
Lookup the graph parent reference to detect a builder cache miss before
looping the whole graph image index to build a parent-children tree.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2015-10-21 17:13:45 +02:00
Morgan Bauer
2abf5d986e
refactor access to daemon member EventsService
Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-10-19 09:41:29 -07:00
Shijiang Wei
2968fa44eb emit a "tag" event when building image with "-t" parameter
This is useful for cluster systems such as swarm to sync the image
state when new images are successfully built.

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-10-19 20:09:14 +08:00
Aaron Lehmann
cba4bbad4f Remove trust package
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-10-12 10:51:28 -07:00
Vincent Demeester
6e12d9fe62 Merge pull request #16865 from MHBauer/registry-service-refactor
refactor away direct references to daemon member
2015-10-11 21:47:58 +02:00
Phil Estes
442b45628e 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)
2015-10-09 17:47:37 -04:00
Morgan Bauer
215bfc73d2
refactor away direct references to daemon member
- add daemon methods Authenticate & SearchRegistryForImages
 - use new methods instead of directly accessing RegistryService

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-10-09 14:40:03 -07:00
Morgan Bauer
ee36b57c8f
continue daemon refactor of Repositories()
- use daemon member directly rather than through a function call
 - create GetImage method for use external to deamon

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-10-08 15:06:55 -07:00
Jess Frazelle
b50a88cfd7 Merge pull request #16644 from dhiltgen/discovery_tls
Add TLS support for discovery backend
2015-10-08 14:21:06 -07:00
Jess Frazelle
67e38cc54c Merge pull request #16638 from MHBauer/daemon-derepo
refactor daemon image tagging
2015-10-08 14:14:20 -07:00
Jess Frazelle
bea2257f92 Merge pull request #16803 from tiborvass/pkg-broadcaster
Move types from progressreader and broadcastwriter to broadcaster
2015-10-08 13:51:08 -07:00
Daniel Hiltgen
124792a871 Add TLS support for discovery backend
This leverages recent additions to libkv enabling client
authentication via TLS so the discovery back-end can be locked
down with mutual TLS.  Example usage:

    docker daemon [other args] \
        --cluster-advertise 192.168.122.168:2376 \
        --cluster-store etcd://192.168.122.168:2379 \
        --cluster-store-opt kv.cacertfile=/path/to/ca.pem \
        --cluster-store-opt kv.certfile=/path/to/cert.pem \
        --cluster-store-opt kv.keyfile=/path/to/key.pem

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2015-10-07 16:01:00 -07:00
Morgan Bauer
77c592d26a
refactor daemon
- create pass through in daemon for access to functions on daemon
   member
 - import image
push image
export image and corrections
lookup image & comments
load image
list images
image history & comments

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-10-07 15:29:02 -07:00
Madhu Venugopal
2ab94e11a2 Network remote APIs using new router, --net=<user-defined-network> changes
* Moving Network Remote APIs out of experimental
* --net can now accept user created networks using network drivers/plugins
* Removed the experimental services concept and --default-network option
* Neccessary backend changes to accomodate multiple networks per container
* Integration Tests

Signed-off-by: David Calavera <david.calavera@gmail.com>
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-07 03:54:19 -07:00
Tibor Vass
2391233404 Move types from progressreader and broadcastwriter to broadcaster
progressreader.Broadcaster becomes broadcaster.Buffered and
broadcastwriter.Writer becomes broadcaster.Unbuffered.

The package broadcastwriter is thus renamed to broadcaster.

Signed-off-by: Tibor Vass <tibor@docker.com>
2015-10-06 22:20:07 -04:00
Arnaud Porterie
33e9d70c82 Merge pull request #16718 from mavenugo/discovery
Vendoring libnetwork integrated with Docker discovery service
2015-10-05 12:06:36 -07:00
Madhu Venugopal
139ea5b7f2 Docker daemon updates to libnetwork discovery support
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-02 20:57:47 -07:00
Daniel Nephin
08b117517d Resolves #16458 - filter events by labels.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-02 16:33:20 -04:00
David Calavera
da982cf551 Separate API router from server.
Implement basic interfaces to write custom routers that can be plugged
to the server. Remove server coupling with the daemon.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-29 19:43:03 -04:00
Tibor Vass
b08f071e18 Revert "Merge pull request #16228 from duglin/ContextualizeEvents"
Although having a request ID available throughout the codebase is very
valuable, the impact of requiring a Context as an argument to every
function in the codepath of an API request, is too significant and was
not properly understood at the time of the review.

Furthermore, mixing API-layer code with non-API-layer code makes the
latter usable only by API-layer code (one that has a notion of Context).

This reverts commit de41640435, reversing
changes made to 7daeecd42d.

Signed-off-by: Tibor Vass <tibor@docker.com>

Conflicts:
	api/server/container.go
	builder/internals.go
	daemon/container_unix.go
	daemon/create.go
2015-09-29 14:26:51 -04:00
Tibor Vass
79c31f4b13 Revert "Merge pull request #16567 from calavera/context_per_request"
This reverts commit ff92f45be4, reversing
changes made to 80e31df3b6.

Reverting to make the next revert easier.

Signed-off-by: Tibor Vass <tibor@docker.com>
2015-09-29 13:40:46 -04:00
Arnaud Porterie
7d193ef1f3 Add builtin nodes discovery
Use `pkg/discovery` to provide nodes discovery between daemon instances.

The functionality is driven by two different command-line flags: the
experimental `--cluster-store` (previously `--kv-store`) and
`--cluster-advertise`. It can be used in two ways by interested
components:

1. Externally by calling the `/info` API and examining the cluster store
   field. The `pkg/discovery` package can then be used to hit the same
   endpoint and watch for appearing or disappearing nodes. That is the
   method that will for example be used by Swarm.
2. Internally by using the `Daemon.discoveryWatcher` instance. That is
   the method that will for example be used by libnetwork.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-09-25 14:52:09 -07:00
Jess Frazelle
ff92f45be4 Merge pull request #16567 from calavera/context_per_request
Define a context per request.
2015-09-25 13:01:51 -07:00
David Calavera
27c76522de Define a context per request.
Avoid creating a global context object that will be used while the daemon is running.

Not only this object won't ever be garbage collected, but it won't ever be used for anything else than creating other contexts in each request. I think it's a bad practive to have something like this sprawling aroud the code.

This change removes that global object and initializes a context in the cases we don't have already one, like shutting down the server.
This also removes a bunch of context arguments from functions that did nothing with it.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-24 18:44:53 -04:00
Michael Crosby
7d8b5fc3aa Fix windows cross compile with new netlink
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-24 15:01:03 -07:00
Michael Crosby
d0fdc3b5df Fix netlink dependency with new pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-24 15:00:30 -07:00
Doug Davis
26b1064967 Add context.RequestID to event stream
This PR adds a "request ID" to each event generated, the 'docker events'
stream now looks like this:

```
2015-09-10T15:02:50.000000000-07:00 [reqid: c01e3534ddca] de7c5d4ca927253cf4e978ee9c4545161e406e9b5a14617efb52c658b249174a: (from ubuntu) create
```
Note the `[reqID: c01e3534ddca]` part, that's new.

Each HTTP request will generate its own unique ID. So, if you do a
`docker build` you'll see a series of events all with the same reqID.
This allow for log processing tools to determine which events are all related
to the same http request.

I didn't propigate the context to all possible funcs in the daemon,
I decided to just do the ones that needed it in order to get the reqID
into the events. I'd like to have people review this direction first, and
if we're ok with it then I'll make sure we're consistent about when
we pass around the context - IOW, make sure that all funcs at the same level
have a context passed in even if they don't call the log funcs - this will
ensure we're consistent w/o passing it around for all calls unnecessarily.

ping @icecrime @calavera @crosbymichael

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-24 11:56:37 -07:00
Jess Frazelle
23750fb802 Merge pull request #15862 from calavera/share_shm_and_mqueue
Share shm and mqueue between containers.
2015-09-24 11:23:59 -07:00
David Calavera
b1d2f52bb2 Improvements to the original sharing implementation.
- Print the mount table as in /proc/self/mountinfo
- Do not exit prematurely when one of the ipc mounts doesn't exist.
- Do not exit prematurely when one of the ipc mounts cannot be unmounted.
- Add a unit test to see if the cleanup really works.
- Use syscall.MNT_DETACH to cleanup mounts after a crash.
- Unmount IPC mounts when the daemon unregisters an old running container.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-23 12:07:24 -04:00
David Calavera
114612305c Merge pull request #16235 from HuKeping/oom-event
Events for OOM needs to be shift to an earlier time
2015-09-22 11:50:30 -07:00
David Calavera
72bb56618b Move volume ref counting store to a package.
- Add unit tests to make sure the functionality is correct.
- Add FilterByDriver to allow filtering volumes by driver, for future
  `volume ls` filtering and whatnot.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-21 12:46:49 -04:00
Hu Keping
f05bacbe50 Events for OOM needs to be shift to an earlier time
It's worth to warn user as soon as possilbe when OOM happend.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-09-21 10:18:08 +08:00
Doug Davis
a283a30fb0 Move api/errors/ to errors/
Per @calavera's suggestion: https://github.com/docker/docker/pull/16355#issuecomment-141139220

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-17 11:54:14 -07:00
John Howard
42a46ed1a4 Windows: Enabled docker volume
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-16 14:33:13 -07:00
Madhu Venugopal
e148e763b8 Update native execdriver to exploit libcontainer hooks
Using @mavenugo's patch for enabling the libcontainer pre-start hook to
be used for network namespace initialization (correcting the conflict
with user namespaces); updated the boolean check to the more generic
SupportsHooks() name, and fixed the hook state function signature.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2015-09-16 12:51:14 -04:00
Brian Goff
e91f2c26ce Merge pull request #15069 from duglin/UseErrorPackage
Use the new error package
2015-09-15 09:28:53 -04:00
Antonio Murdaca
db2ac8655d Merge pull request #16275 from coolljt0725/fix_register_failed_and_start
Fix container register failed during daemon start and then start the container
2015-09-15 11:46:03 +02:00
Doug Davis
628b9a41b0 Use the new error package
This is the first step in converting out static strings into well-defined
error types.  This shows just a few examples of it to get a feel for how things
will look. Once we agree on the basic outline we can then work on converting
the rest of the code over.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-14 13:11:01 -07:00
Madhu Venugopal
d0e0c13b60 Vendor-in 2baa2ddc78b42f011f55633282ac63a72e1b09c1 for userns support
Changes include :
* libnetwork support for userns
* driver api change to have 1 interface per endpoint

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-09-14 11:04:12 -07:00
Lei Jitang
b4841dd237 Fix container register failed during daemon start and try to start the container
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-09-13 22:52:56 -04:00
Mrunal Patel
c8291f7107 Add support for sharing /dev/shm/ and /dev/mqueue between containers
This changeset creates /dev/shm and /dev/mqueue mounts for each container under
/var/lib/containers/<id>/ and bind mounts them into the container. When --ipc:container<id/name>
is used, then the /dev/shm and /dev/mqueue of the ipc container are used instead of creating
new ones for the container.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)

(cherry picked from commit d88fe447df)
2015-09-11 14:02:11 -04:00
David Calavera
3781cde61f Add STOPSIGNAL instruction to dockerfiles.
This way, images creators can set the exit signal their programs use.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-10 19:56:05 -04:00
David Calavera
0e50d946a2 Signal to stop a container.
Allow to set the signal to stop a container in `docker run`:
- Use `--stop-signal` with docker-run to set the default signal the container will use to exit.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-10 19:56:05 -04:00
Antonio Murdaca
587823af27 daemon: remove unused function params
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-09-09 22:37:46 +02:00
Brian Goff
dc8a39036b Don't lookup container 4 times for stats
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-09-08 10:12:46 -04:00
Ma Shimiao
89f99343ff daemon/daemon: fix typo
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-09-07 14:43:22 +08:00
John Howard
6c56f917d3 Windows: Ensure workdir handled in platform semantics
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-01 18:50:41 -07:00
Antonio Murdaca
4bb2449188 Merge pull request #15913 from mountkin/abstract
abstract the string slice struct to stringutils package
2015-09-01 17:06:13 +02:00