Commit Graph

93 Commits

Author SHA1 Message Date
0c9780ee15 Fix docker top a restarting container
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 5566ccb7aa0747005573f6f4f04f46552b75a394
Component: engine
2016-02-02 21:05:01 -05:00
1083d494cd Forbid exec a restarting container
Currently if we exec a restarting container, client will fail silently,
and daemon will print error that container can't be found which is not a
very meaningful prompt to user.

This commit will stop user from exec a restarting container and gives
more explicit error message.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 1d2208fed90da9ab72ded3b1c65bb2a71b66ce93
Component: engine
2016-01-27 10:05:06 +08:00
addf165927 Fix panic on starting exec more than once
Issue was caused when exec is tarted, exits, then stated again.
In this case, `Close` is called twice, which closes a channel twice.

Changes execConfig.ExitCode to a pointer so we can test if the it has
been set or not.
This allows us to return early when the exec has already been run.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 1a60a805bfabee729dbc833515cd0be439adb95b
Component: engine
2016-01-15 11:57:23 -05:00
4ec2693c9e Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 907407d0b2e5863f0e1b40b93a356bbf03c7b9fb
Component: engine
2016-01-06 19:48:59 -05:00
5582f5eb83 Implement configurable detach key
Implement configurable detach keys (for `attach`, exec`, `run` and
`start`) using the client-side configuration

- Adds a `--detach-keys` flag to `attach`, `exec`, `run` and `start`
  commands.
- Adds a new configuration field (in `~/.docker/config.json`) to
  configure the default escape keys for docker client.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 15aa2a663b47b6126a66efefcadb64edfbffb9f5
Component: engine
2016-01-03 23:03:39 +01:00
f1f019f89d Move ExecConfig to types.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 839f73c3028629ac1dde6617d6466b98f2bde416
Component: engine
2015-12-22 13:31:46 -05:00
7e8fcbf740 Move StrSlice to types.
This is a very docker concept that nobody elses need.
We only maintain it to keep the API backwards compatible.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: f9b857a200696b07b67e6a7f94ede32487f5649d
Component: engine
2015-12-22 13:31:43 -05:00
2cee7ddb46 Rename Daemon.Get to Daemon.GetContainer.
This is more aligned with `Daemon.GetImage` and less confusing.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: d7d512bb927023b76c3c01f54a3655ee7c341637
Component: engine
2015-12-11 12:39:28 -05:00
d010c48ce4 Move Container to its own package.
So other packages don't need to import the daemon package when they
want to use this struct.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 6bb0d1816acd8d4f7a542a6aac047da2b874f476
Component: engine
2015-12-03 17:39:49 +01:00
4c65875314 Move exec store to its own package inside the daemon.
Remove double reference between containers and exec configurations by
keeping only the container id.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 9ca2e4e81cdb950f2b5958a7712153d1a6dd6e4c
Component: engine
2015-11-20 17:40:16 -05:00
2b61f40d62 Merge pull request #18051 from calavera/extract_streams
Extract StreamConfig struct out of the daemon package.
Upstream-commit: b5c507750f2c7f616ed94ad502f5f6904cad4eac
Component: engine
2015-11-20 13:45:13 -08:00
a043562f2a Extract StreamConfig struct out of the daemon package.
This is a small configuration struct used in two scenarios:

1. To attach I/O pipes to a running containers.
2. To attach to execution processes inside running containers.

Although they are similar, keeping the struct in the same package
than exec and container can generate cycled dependencies if we
move any of them outside the daemon, like we want to do
with the container.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 3f5b8f712d693188b41b3d9b55e5e5213be48ef5
Component: engine
2015-11-20 15:04:27 -05:00
7d68517eab Update docs and test of exec create api return codes
Fixes issue #18054

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
Upstream-commit: 01b86d612cba22602509b436aad36d41135f14ce
Component: engine
2015-11-19 22:22:27 +08:00
c1e130b932 Merge pull request #17589 from Microsoft/jjh/refactorprocessconfig
Refactor ProcessConfig
Upstream-commit: 8cf38b6a8b031bd0d39d80d0a1d1b6e860a43acb
Component: engine
2015-11-12 07:28:32 -08:00
3ba5945bba Remove unnecessary var block in monitorExec
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 445675e8081ae1e911db2ebd57efd51329574cdf
Component: engine
2015-11-09 15:14:20 -08:00
97bbd407aa Refactor ProcessConfig
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 5fa2e4d4f2be7787ad29b1e6ffd9c026ea0c1925
Component: engine
2015-11-09 09:51:09 -08: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
1820467533 Remove further references to the daemon within containers.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 63efc12070b2aff0f062ad62cc577cf2ffb66ef6
Component: engine
2015-11-04 12:28:54 -05:00
cf2d677f4e Decouple daemon and container to log events.
Create a supervisor interface to let the container monitor to emit events.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: ca5ede2d0a23cb84cac3b863c363d0269e6438df
Component: engine
2015-11-04 12:27:48 -05:00
ad803b2d26 Decouple daemon and container to execute processes.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: c1c42db060362e400a475dfb2884f89b86fce317
Component: engine
2015-11-04 12:27:48 -05:00
aa4d367db2 Merge pull request #16803 from tiborvass/pkg-broadcaster
Move types from progressreader and broadcastwriter to broadcaster
Upstream-commit: bea2257f926ad8e49973d695254669c159987d19
Component: engine
2015-10-08 13:51:08 -07:00
1f889ca641 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>
Upstream-commit: 2391233404e2e6892c79a24f31cc99715c086b21
Component: engine
2015-10-06 22:20:07 -04:00
cb460a3ef9 Cleanup some issues with exec
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 561005e5ca00a8c24e83294e7005bdaf32f19d5a
Component: engine
2015-10-06 15:22:20 -04:00
a9fcaeb043 Make exec start return proper error codes
Exec start was sending HTTP 500 for every error.

Fixed an error where pausing a container and then calling exec start
caused the daemon to freeze.

Updated API docs which incorrectly showed that a successful exec start
was an HTTP 201, in reality it is HTTP 200.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 2d43d93410c29cec87deb9cd940c3b2a8af5fbbb
Component: engine
2015-10-02 14:40:22 -04:00
69db6279aa 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 de4164043546d2b9ee3bf323dbc41f4979c84480, reversing
changes made to 7daeecd42d7bb112bfe01532c8c9a962bb0c7967.

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

Conflicts:
	api/server/container.go
	builder/internals.go
	daemon/container_unix.go
	daemon/create.go
Upstream-commit: b08f071e18043abe8ce15f56826d38dd26bedb78
Component: engine
2015-09-29 14:26:51 -04:00
bf44c732da 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>
Upstream-commit: 26b1064967d9fcefd4c35f60e96bf6d7c9a3b5f8
Component: engine
2015-09-24 11:56:37 -07:00
5ee0f81315 Move more 'daemon' errors to the new error package
Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 0a734182eb09497806a9ff3e1c8031ab1ab39f13
Component: engine
2015-09-23 09:51:45 -07:00
e3b5e8b7ff 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)
Upstream-commit: e148e763b8e7879855022690fdea88a6bf869195
Component: engine
2015-09-16 12:51:14 -04:00
c60fcca7ee Merge pull request #15913 from mountkin/abstract
abstract the string slice struct to stringutils package
Upstream-commit: 4bb2449188a7d09de5fd35d1be4b35dd5780c825
Component: engine
2015-09-01 17:06:13 +02:00
6190aee4a2 abstract the string slice struct to stringutils package
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: ea4a06740b6d4579f77507c1d7e0897a870fd72d
Component: engine
2015-08-29 01:08:40 +08:00
1870e3919c golint fixes for daemon/ package
- some method names were changed to have a 'Locking' suffix, as the
 downcased versions already existed, and the existing functions simply
 had locks around the already downcased version.
 - deleting unused functions
 - package comment
 - magic numbers replaced by golang constants
 - comments all over

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
Upstream-commit: abd72d4008dde7ee8249170d49eb4bc963c51e24
Component: engine
2015-08-27 22:07:42 -07:00
337be087f4 Revert "Revert "Add docker exec run a command in privileged mode""
This reverts commit 40b71adee390e9c06471b89ed845132b4ec80177.

Original commit (for which this is effectively a rebased version) is
72a500e9e5929b038816d8bd18d462a19e571c99 and was provided by Lei Jitang
<leijitang@huawei.com>.

Signed-off-by: Tim Dettrick <t.dettrick@uq.edu.au>
Upstream-commit: 03f65b3d0d66ccdc8b69a447b75508d594007600
Component: engine
2015-08-13 16:36:44 +10:00
978d8e86f8 Return better errors from exec
Also cleans up some of the API side of exec.
Was writing the header twice (two different headers).

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: f078f75bf25353720f28f9f1ea180374fe205302
Component: engine
2015-08-10 09:53:19 -04:00
67bf5ba305 Replace GenerateRandomID with GenerateNonCryptoID
This allow us to avoid entropy usage in non-crypto critical places.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 6bca8ec3c9ccc169c53b3d7060fe5c8ba8670aac
Component: engine
2015-07-28 22:31:01 -07:00
1b5a1d2d53 Merge pull request #14547 from duglin/ErrDeadExec
Return 404 on exec-inspect when container is dead but exec is still around
Upstream-commit: 4dbdd98b4142dbda1c6028c17a9a0d6dd8cdce04
Component: engine
2015-07-27 10:46:32 -07:00
a1d7796250 fix the panic caused by resizing a starting exec
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: ba5e0980527d3477cb85925e07eecb28dfe50e08
Component: engine
2015-07-24 20:43:07 +08:00
0a8f0f82e0 Quieter debug logging for clean exec commands
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: b271593c34a67f4040405c952fdb402bf5dcd151
Component: engine
2015-07-13 10:36:36 -07:00
1e1ad91010 Return 404 on exec-inspect when container is dead but exec is still around
When a container is removed but it had an exec, that still hasn't been
GC'd per PR #14476, and someone tries to inspect the exec we should
return a 404, not a 500+container not running.  Returning "..not running" is
not only misleading because it could lead people to think the container is
actually still around, but after 5 minutes the error will change to a 404
after the GC. This means that we're externalizing our internall soft-deletion/GC
logic which shouldn't be any of the end user's concern. They should get the
same results immediate or after 5 minutes.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: d841b779fda882c3fd505f626c01cc9d60768aa6
Component: engine
2015-07-10 20:19:42 -07:00
e0ffc7b501 Use mark and sweep for exec command removal
This takes the final removal for exec commands in two steps.  The first
GC tick will mark the exec commands for removal and then the second tick
will remove the config from the daemon.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 34ab8c432691934745d66ee94ff4aec1120518e0
Component: engine
2015-07-09 14:51:10 -07:00
6d71e61742 Add GC loop to clean exec command refs on daemon
This adds an event loop for running a GC cleanup for exec command
references that are on the daemon.  These cannot be cleaned up
immediately because processes may need to get the exit status of the
exec command but it should not grow out of bounds.  The loop is set to a
default 5 minute interval to perform cleanup.

It should be safe to perform this cleanup because unless the clients are
remembering the exec id of the process they launched they can query for
the status and see that it has exited.  If they don't save the exec id
they will have to do an inspect on the container for all exec instances
and anything that is not live inside that container will not be returned
in the container inspect.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 5f017bba48e5c763157e1b35a5edea64cc41fc6a
Component: engine
2015-07-08 13:47:59 -07:00
51dfe1d73a Remove exec config from container after exit
This removes the exec config from the container after the command exits
so that dead exec commands are not displayed in the container inspect.
The commands are still kept on the daemon so that when you inspect the
exec command, not the container, you are still able to get it's exit
status.

This also changes the ProcessConfig to a pointer.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 04c9f86bdcf9f42deb09df76922a8c61205721a2
Component: engine
2015-07-08 10:55:42 -07:00
d99f89f02c Merge pull request #14268 from unclejack/lower_allocations_execdriver
daemon: lower allocations
Upstream-commit: bb364ff459e8ebcc601a13057a1477336646474b
Component: engine
2015-06-30 12:12:06 -07:00
b565b94e85 daemon: lower allocations
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: c1477db04fc32621652cf6a8fd2976b6bbf2066e
Component: engine
2015-06-30 01:45:31 +03:00
73973301dc Default process user to container config user.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 0faa4518ed2dad592bb238838b4df2b34d2171c3
Component: engine
2015-06-29 12:52:05 -07:00
4f79291859 Cleanup container LogEvent calls
Move some calls to container.LogEvent down lower so that there's
less of a chance of them being missed. Also add a few more events
that appear to have been missed.

Added testcases for new events: commit, copy, resize, attach, rename, top

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 8232312c1e705753d3db82dca3d9bb23e59c3b52
Component: engine
2015-06-01 12:39:28 -07:00
d89704cf56 Revert "Add docker exec run a command in privileged mode"
This reverts commit 72a500e9e5929b038816d8bd18d462a19e571c99.

Signed-off-by: Jessica Frazelle <princess@docker.com>

Conflicts:
	daemon/execdriver/native/exec.go
	integration-cli/docker_cli_exec_test.go
	runconfig/exec.go
Upstream-commit: 40b71adee390e9c06471b89ed845132b4ec80177
Component: engine
2015-05-26 14:12:16 -07:00
8b7803021e Windows: Split ContainerExecCreate
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: e35b025aa61e7d8db04a9973967b7109f742593a
Component: engine
2015-05-06 16:19:27 -07:00
5306450032 cleanup: move container's functions to its file
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
Upstream-commit: 1be7a10b89506afdcb80f109f323b6e47d2e466c
Component: engine
2015-05-04 21:37:44 +08:00
954f940156 Small if err cleaning
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 844538142d95c1b7dda1bb2903179510105fe9b5
Component: engine
2015-04-27 21:50:33 +02:00
f089bf1e0a remove execCreate & execStart from job
Also removed the function ExecConfigFromJob

Signed-off-by: Sun Jianbo <wonderflow@zju.edu.cn>
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 24425021d26f29a475702064181e6c99fb6bd1c5
Component: engine
2015-04-22 13:51:57 -07:00