Commit Graph

375 Commits

Author SHA1 Message Date
d47b1c8a71 Move errors/ to api/errors
Using:
        gomvpkg -from github.com/docker/docker/errors
                -to github.com/docker/docker/api/errors
                -vcs_mv_cmd "git mv {{.Src}} {{.Dst}}"

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c452e1bfe6b19d44bf2ed2a1eb8aef7e23d6bafb
Component: engine
2016-09-16 12:27:13 -04:00
45ddc4bfcb Add engine-api types to docker
This moves the types for the `engine-api` repo to the existing types
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 91e197d614547f0202e6ae9b8a24d88ee131d950
Component: engine
2016-09-07 11:05:58 -07:00
84a36bbfd3 Merge pull request #24073 from johnharris85/move-restart-policy-check-to-daemon
Move restart-policy validation from client to daemon.
Upstream-commit: d13ad3ef7684bf330cec2eaa4a14048e3fbc2d94
Component: engine
2016-08-25 17:02:30 +02:00
34a323258f Wait container's removal via Events API
If AutoRemove is set, wait until client get `destroy` events, or get
`detach` events that implies container is detached but not stopped.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 6dd8e10d6ed7a7371c5c1824ad58c4403a7b3bfd
Component: engine
2016-08-08 22:46:53 +08:00
b27f1b6d73 Move --rm to daemon side
`--rm` is a client side flag which caused lots of problems:
1. if client lost connection to daemon, including client crash or be
killed, there's no way to clean garbage container.
2. if docker stop a `--rm` container, this container won't be
autoremoved.
3. if docker daemon restart, container is also left over.
4. bug: `docker run --rm busybox fakecmd` will exit without cleanup.

In a word, client side `--rm` flag isn't sufficient for garbage
collection. Move the `--rm` flag to daemon will be more reasonable.

What this commit do is:
1. implement a `--rm` on daemon side, adding one flag `AutoRemove` into
HostConfig.
2. Allow `run --rm -d`, no conflicting `--rm` and `-d` any more,
auto-remove can work on detach mode.
3. `docker restart` a `--rm` container will succeed, the container won't
be autoremoved.

This commit will help a lot for daemon to do garbage collection for
temporary containers.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 3c2886d8a45d8e79b00ab413d91f1af871b58d0a
Component: engine
2016-08-08 22:46:53 +08:00
a3566ce47a Move restart-policy validation from client to daemon.
Signed-off-by: John Harris <john@johnharris.io>
Upstream-commit: 94e95e4711643640701bd614902e75a2d01f12c5
Component: engine
2016-08-06 20:09:47 -07:00
e4dfc2d04c Validate hostname starting from 1.24 API.
In order to keep a little bit of "sanity" on the API side, validate
hostname only starting from v1.24 API version.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 6daf3d2a783fd042e870c8af8bbd19fc28989505
Component: engine
2016-07-06 09:13:59 +02:00
be63983b3a Add Swarm management backend
As described in our ROADMAP.md, introduce new Swarm management API
endpoints relying on swarmkit to deploy services. It currently vendors
docker/engine-api changes.

This PR is fully backward compatible (joining a Swarm is an optional
feature of the Engine, and existing commands are not impacted).

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: 534a90a99367af6f6bba1ddcc7eb07506e41f774
Component: engine
2016-06-13 22:16:18 -07:00
fe69a90880 Moving some more methods away from daemon.go
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: bfa0885c37efe5734d93f5bbb9e6477f66358e7c
Component: engine
2016-05-27 11:32:26 +02:00
565bc9079d Move some container related methods and structs to smaller files
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: fb48bf518bfc200ee9a230a7bedaf640df4e5dae
Component: engine
2016-05-24 21:31:15 +02: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
121cf6f1ca Make sure container start doesn't make the DNS fields nil.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: d7117a1b713042096bd97815bbb9663a4a01c8af
Component: engine
2015-11-30 22:46:31 -05: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
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
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
b104ad8df6 Remove the container initializers per platform.
By removing deprecated volume structures, now that windows mount volumes we don't need a initializer per platform.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 060f4ae6179b10aeafa883670826159fdae8204a
Component: engine
2015-11-18 08:41:46 -05:00
d91b38c0d5 Merge pull request #17877 from aaronlehmann/capped-bytespipe
Cap the amount of buffering done by BytesPipe
Upstream-commit: 13963957ebadc663915aed8c61451a93db41c27c
Component: engine
2015-11-14 00:51:11 +02:00
971f161db1 Cap the amount of buffering done by BytesPipe
Turn BytesPipe's Read and Write functions into blocking, goroutine-safe
functions. Add a CloseWithError function to propagate an error code to
the Read function.

Adjust tests to work with the blocking Read and Write functions.

Remove BufReader, since now its users can use BytesPipe directly.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 64f8ee444d23ae29a236f169f1d7faf7042b524a
Component: engine
2015-11-12 10:11:29 -08:00
d8d32d2bbf Windows [TP4] Fix docker cp when volumes
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 3a852d8442f31651f0e776430432e5dda44455e0
Component: engine
2015-11-11 14:02:07 -08:00
0345dce058 Use an empty slice as default value for DNS, DNSSearch and DNSOptions
So we don't print those <no value> in the client and we don't fail
executing inspect templates with API field names.

Make sure those fields are initialized as empty slices when
a container is loaded from disk and their values are nil.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: f1a74a89f89affcfbe311e89aa752b3d551e0340
Component: engine
2015-11-09 12:46:48 -05:00
13125ff6b4 Merge pull request #17700 from calavera/remove_lxc
Remove LXC support.
Upstream-commit: 2519f465501657c24ecd13b8e53964b6c2f1a78d
Component: engine
2015-11-05 15:22:37 -08:00
f427a47755 Remove exec-driver global daemon option.
Each platform has only a driver now.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 157b66ad390902ef6f5b51b3f76d5177eacac81b
Component: engine
2015-11-05 17:09:58 -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
b37ddbaf2b Move errcode handling for resize upper
It'll allow to separate daemon layer more cleanly later.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: bb0e7eb196c65972ea66154461b7e654d776f92a
Component: engine
2015-11-05 13:42:33 -08: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
2b73c2cc80 Remove daemon field from container.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 444c82d19d3c8ee51f313c879d434ac5b8be6a6f
Component: engine
2015-11-04 12:27:49 -05:00
c61aec7054 Decouple daemon and container from the stats collector.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 5dc3a9a6da6ce6e3eee791251293cf045a4754f9
Component: engine
2015-11-04 12:27:49 -05:00
0e98961ec3 Decouple daemon and container to configure logging drivers.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: c412300dd9f85301e2922ccc7c954eaa37fadcab
Component: engine
2015-11-04 12:27:49 -05:00
ae0ea71e8c Decouple daemon and container to cleanup containers.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 019c337b93d5e068fa7c701d8b70750052503188
Component: engine
2015-11-04 12:27:48 -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
8678b0dd0d Decouple daemon and container to manage volumes.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 2c72015ce3b78b45e33529368fb1c5a724415d87
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
28971757bb Move Daemon.containerCopy to daemon/archive.go
It's the only place where it's used.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: ebf707ec5fc9e942b89f6405df35cd6c0fabb15b
Component: engine
2015-11-04 12:27:48 -05:00
c4c84fb5f6 Remove unused function Container.getImage.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 89decc4446ad01a5595de1b93c17c37232f8a9aa
Component: engine
2015-11-04 12:27:48 -05:00
6943fc8dc1 Remove unnecessary Container.changes function.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 6ea9a880dc434446c072ac23b1cab89ec3652140
Component: engine
2015-11-04 12:27:48 -05:00
b52340d649 Decouple daemon and container to mount and unmount filesystems.
Side effects:
- Decouple daemon and container to start containers.
- Decouple daemon and container to copy files.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 3a497650464b40191bd2cde348e676acf4efe270
Component: engine
2015-11-04 12:27:47 -05:00
57930f801e Decouple daemon and container to export containers.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 1c94f5f53a47997f76cafb633092fce9dbdab3ea
Component: engine
2015-11-04 12:27:47 -05:00
d721eb8e53 Decouple daemon and container to pause and unpause containers.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 9f79cfdb2f1f6aeb64c84e7cb877fc38d052d187
Component: engine
2015-11-04 12:27:47 -05:00
41d5167da1 Decouple daemon and container to stop and kill containers.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 4f2a5ba360d0b00213d31f50a5be074c89124c52
Component: engine
2015-11-04 12:27:47 -05:00
aecf79764a Move exportContainerRw to the daemon.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 581380cc6cd26f43fe5e69965873769d8dc739ef
Component: engine
2015-11-04 12:27:47 -05:00
014aae9963 Merge pull request #17630 from LK4D4/syscall_umount_warn
Do not ignore error from syscall.Unmount
Upstream-commit: c9208953fac6174bb205bd1b3705f81a602869c2
Component: engine
2015-11-03 19:58:19 -05:00
56e28325cd Merge pull request #17629 from tonistiigi/kill-autorestart-fix
Fix race causing autorestart turning off on restart
Upstream-commit: 8d5695470ae909d0abb62e10f41c6e5f342520cd
Component: engine
2015-11-03 08:24:11 -08:00
0c95e3cdf7 Fix race causing autorestart turning off on restart
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: b8aaa4b07c100a338136be82292289a37b09b5e7
Component: engine
2015-11-02 18:37:55 -08:00
2f6185bd11 Merge pull request #17628 from LK4D4/umount_log_err
Log error from unmountVolumes on cleanup
Upstream-commit: 79d47c5b96c18c4497c0669c343fa05517ea3caa
Component: engine
2015-11-02 15:38:32 -08:00
8388c2e10b Do not ignore error from syscall.Unmount
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 3f10bdf100067580c35e27524b10ad06fadd0527
Component: engine
2015-11-02 14:40:29 -08:00
9400b9a7bc Merge pull request #17554 from calavera/warm_ipc_unmounts
Turn IPC unmount errors into warnings.
Upstream-commit: 944ea3134d6fd68ff33f9bdd2f5b87d458824079
Component: engine
2015-11-02 14:25:39 -08:00
74bc9966e0 Log error from unmountVolumes on cleanup
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a20fea1823ccfb40d235607e8f7ce7ceff1b5afe
Component: engine
2015-11-02 14:11:42 -08:00
7e5c1a1c97 Merge pull request #17545 from LK4D4/writehs_encode
Use json.Encoder for container.writeHostConfig
Upstream-commit: f87082f08e6b91a33e251215040350faa0d78d71
Component: engine
2015-10-30 21:11:15 -04:00
9be4647b0f Turn IPC unmount errors into warnings.
And do not try to unmount empty paths.

Because nobody should be woken up in the middle of the night for them.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: a54d5932e3a644317c77d59bc5aee562841d5c20
Component: engine
2015-10-30 19:13:52 -04:00
2631995b0b Remove unnecessary Stat check from readHostConfig
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 36a69bbc6050c5916f7267679ff7d61b5dfc5b8e
Component: engine
2015-10-30 14:54:09 -07:00