Commit Graph

670 Commits

Author SHA1 Message Date
Fernando Mayo
0a26b0fe43 ctr: fix --mount help message
Signed-off-by: Fernando Mayo <fermayo@gmail.com>
2018-04-17 18:29:33 -07:00
Justin Cormack
903191072e
Add --privileged option to ctr run
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-04-04 13:25:42 +01:00
Michael Crosby
3e8e9d3ed7
Merge pull request #2223 from dmcgowan/with-lease-context
lease: pass in context to lease done function in client
2018-03-23 10:27:39 -04:00
Derek McGowan
43d0a5cb60
Pass in context to lease done function in client
Allows the client to choose the context to finish the lease.
This allows the client to switch contexts when the main context
used to the create the lease may have been cancelled.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-03-22 14:09:24 -07:00
Stephen J Day
903ee88368
cmd/ctr/app: remove redundant package name
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-03-22 10:12:00 -07:00
Derek McGowan
a0b818e093
Merge pull request #2200 from jessvalarezo/multiarch-pulls
allow content to be pulled for specific platform(s), all platforms
2018-03-14 14:46:30 -07:00
Phil Estes
b307df2723
Merge pull request #2207 from jessvalarezo/ctr-task-d-update
ctr: allow for force kill when deleting task process
2018-03-14 03:41:23 -04:00
Lantao Liu
ea6a10c412 Add cri subcommand and add ctr/command package
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-03-14 01:11:29 +00:00
Jess Valarezo
e343006b8f ctr: allow for force kill when deleting task process
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2018-03-13 14:58:31 -07:00
Stephen J Day
ae11d8c64b
cmd/ctr/images: add i alias for images command
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-03-12 17:42:41 -07:00
Jess Valarezo
c3cf3d7822 allow content to be pulled for specific platform(s), all platforms
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2018-03-12 17:31:42 -07:00
Stephen Day
3013762fc5
Merge pull request #2203 from Random-Liu/support-in-process-integration
Support in process integration
2018-03-12 14:38:27 -07:00
Lantao Liu
1128b3d664 Add service plugin and support in process integration.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-03-12 18:03:50 +00:00
Stephen Day
5368984859
Merge pull request #2160 from ijc/ctr-run-unpack
ctr: unpack the image on run if necessary
2018-03-06 19:29:43 -08:00
Derek McGowan
2b6b99b4a1
Merge pull request #2184 from kunalkushwaha/oci-error
better image config parse error.
2018-03-05 10:29:02 -08:00
Akihiro Suda
05513284e7 ctr: add UNIX-specific flags to ctr c create
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-03-05 15:26:03 +09:00
Kunal Kushwaha
6ed4e9e106 better image config parse error.
compatible oci runtime version printed with parse error

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-03-05 14:04:08 +09:00
Ian Campbell
f48cc7d7fe ctr: unpack the image on run if necessary
Without this `ctr run` can fail with:

    ctr: parent snapshot sha256:70798fd80095f40b41baa5d107fb61532bfe494d96313fea01e8fcbf4e8743ee does not exist: not found

My image was produced by buildkit, which doesn't unpack (I think this makes
sense since buildkit doesn't know if I am going to run the image or export/push
it etc).

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2018-02-26 14:23:28 +00:00
Michael Crosby
d3a8055e2d Add --pid-file to ctr
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-02-20 15:10:50 -05:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Phil Estes
e4e53bf486
Add --with-ns flag to ctr run/create
Adds a useful flag to `ctr` to enable joining any existing Linux
namespaces for any namespace types (network, pid, ipc, etc.) using the
existing With helper in the oci package.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2018-02-16 15:23:04 -05:00
Michael Crosby
78bd07afef
Merge pull request #1746 from AkihiroSuda/split-differ-interface
diff: resplit Applier from Differ
2018-02-05 09:18:56 -05:00
Michael Crosby
5f89502a24
Merge pull request #1790 from jessvalarezo/ctr-c-create
ctr: add container create cmd and config flag
2018-01-29 17:19:14 -05:00
Derek McGowan
b763777288
diff: rename differ to comparer
Remove combined interface and split implementations.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-01-26 16:32:09 -08:00
Phil Estes
d4fb0709c9
Add error return for missing params in ctr images
For missing required parameters adds error return before attempting any
actions to `ctr images` commands.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2018-01-26 09:14:13 -05:00
Jess Valarezo
2c9ce2e693 ctr: add container create, config flag for spec
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2018-01-25 17:16:13 -08:00
Darren Stahl
dcff993653 Update Windows runtime to use snapshotter and differ layers
This changes the Windows runtime to use the snapshotter and differ
created layers, and updates the ctr commands to use the snapshotter and differ.

Signed-off-by: Darren Stahl <darst@microsoft.com>
2018-01-23 14:40:24 -08:00
Phil Estes
d7efcbc083
Merge pull request #2036 from stevvooe/use-buffer-pools
archive, cio, cmd, linux: use buffer pools
2018-01-23 15:00:41 -05:00
Phil Estes
dc5964ccc2
Merge pull request #2037 from pauldotknopf/master
Made a public method to set environment variables and mounts for containers.
2018-01-22 17:05:26 -05:00
Stephen J Day
cd72819b53
archive, cio, cmd, linux: use buffer pools
To avoid buffer bloat in long running processes, we try to use buffer
pools where possible. This is meant to address shim memory usage issues,
but may not be the root cause.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-01-22 13:52:06 -08:00
Paul Knopf
b4c3cd7640
Add WithEnv and WithMount oci options
Signed-off-by: Paul Knopf <pauldotknopf@gmail.com>
2018-01-22 16:35:31 -05:00
Akihiro Suda
507a149488 cio: add WithFIFODir opt
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-01-18 14:33:56 +09:00
Akihiro Suda
1167035be3 ctr: promote cOpts over opts, as oci.WithImageConfig requires snapshot
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-01-11 14:04:11 +09:00
Daniel Nephin
184bc25629 Add unconvert linter
This linter checks for unnecessary type convertions.

Some convertions are whitelisted because their type is different
on 32bit platforms

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2018-01-09 17:36:44 -05:00
Kenfe-Mickael Laventure
0cc79a6ff6
Add no-pivot flag to ctr
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2018-01-09 07:48:30 -08:00
Michael Crosby
4e755ad383
Merge pull request #1947 from jessvalarezo/ctr-snapshot-diff
ctr: snapshots diff command
2018-01-03 11:34:29 -05:00
Jess Valarezo
625eb5e661 ctr: snapshots diff command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2018-01-02 21:18:12 -05:00
Michael Crosby
399e3c57c3 Change ctr help for mount from dest to dst
dest is not valid, only destination and dst

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-12-15 16:40:25 -05:00
Phil Estes
afbbe43745
Merge pull request #1895 from dnephin/refactor-cio
Refactor cio package
2017-12-15 14:44:44 -05:00
Stephen J Day
9aeeefae55
cmd/ctr: stablize output of snapshot tree
Preserves the order of the tree output between each execution. Slightly
refactored the behavior to be more "object oriented".

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-12-12 14:50:05 -08:00
Daniel Nephin
7d4337e738 Reduce the number of IO constructors
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-12-11 15:07:09 -05:00
Derek McGowan
40c67fdf78
Merge pull request #1880 from AkihiroSuda/refactor-importer
importer: refactor and fix GC
2017-12-04 20:56:26 -08:00
Akihiro Suda
63401970c7 importer: refactor
- Use lease API (previoisly, GC was not supported)
- Refactored interfaces for ease of future Docker v1 importer support

For usage, please refer to `ctr images import --help`.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-12-05 12:48:32 +09:00
Stephen J Day
1710fe9b95
cmd/ctr: move log messages to debug
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-12-01 13:57:54 -08:00
Jess Valarezo
9885edfc44 rename snapshot->snapshots pkg
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-29 14:55:02 -08:00
Jess Valarezo
61c8fe2307 ctr: snapshot->snapshots cmd, add aliases
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-29 14:34:02 -08:00
Akihiro Suda
7f95b9f987 ctr: add EnvVar CONTAINERD_SNAPSHOTTER for --snapshotter
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-11-29 19:11:10 +09:00
Phil Estes
2556c594ec
Merge pull request #1767 from stevvooe/ttrpc-shim
linux/shim: reduce memory overhead by using ttrpc
2017-11-28 12:43:41 -05:00
Stephen Day
372cdfac3b
Merge pull request #1638 from dmcgowan/gc-policy
gc: add policy plugin
2017-11-27 18:20:10 -08:00
Daniel Nephin
cdf62f69a1 Fix usage of oci in other packages.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-27 16:16:17 -05:00
Daniel Nephin
0103d14b47 Fix ctr events
add import to register event types with grpc

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-24 14:28:44 -05:00
Stephen J Day
e8f52c35ce
linux/shim: reduce memory overhead by using ttrpc
By replacing grpc with ttrpc, we can reduce total memory runtime
requirements and binary size. With minimal code changes, the shim can
now be controlled by the much lightweight protocol, reducing the total
memory required per container.

When reviewing this change, take particular notice of the generated shim
code.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-22 12:21:48 -08:00
Daniel Nephin
f74862a0dd Add structcheck, unused, and varcheck linters.
Warn on unused and dead code

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-21 11:14:37 -05:00
Derek McGowan
3f1a61f76a
Add synchronous image delete
Synchronous image delete provides an option image delete to wait
until the next garbage collection deletes after an image is removed
before returning success to the caller.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-20 17:08:35 -08:00
Daniel Nephin
298dabc6c2 Move io.go into cio package
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-17 17:04:45 -05:00
Stephen J Day
c5022ad92d
protobuf: use the gogo/types package for empty
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-15 19:08:54 -08:00
Stephen Day
571c002ef6
Merge pull request #1755 from AkihiroSuda/fix-ctr-snapshot-args
ctr: fix args
2017-11-14 17:55:14 -08:00
Akihiro Suda
5eff92d1ba ctr: fix args
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-11-15 01:34:12 +00:00
Stephen Day
f9933e9f96
Merge pull request #1742 from jessvalarezo/ctr-task-kill
ctr: update task kill to take exec-id
2017-11-13 13:53:26 -08:00
Michael Crosby
92ca22c997
Merge pull request #1735 from estesp/image-rm-feedback
Fix output on ctr images rm to show actual feedback
2017-11-13 14:18:12 -05:00
Jess Valarezo
1966f9f1b7 ctr: update task kill to take exec-id
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-13 10:47:15 -08:00
Phil Estes
08760757ed
Fix output on ctr images rm to show actual feedback
Currently the output for a non-existent image reference and a valid
image reference is exactly the same on `ctr images remove`. Instead of
outputting the target ref input, if it is "not found" we should alert
the user in case of a mispelling, but continue not to make it a failure
for the command (given it supports multiple ref entries)

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2017-11-10 15:21:27 -05:00
Jess Valarezo
807f4d2ec7 expose exec-id on ctr task ps
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-10 11:38:51 -08:00
Victor Vieux
f8a536ed6a Add S to PLATFORM in images & plugins list
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-11-08 10:43:12 -08:00
Sebastiaan van Stijn
65d5b8b937
Align version output and minor code cleanup
This patch changes the output of `ctr version` to align version and revision.
It also changes `.Printf()` to `.Println()`, to make the code slightly easier
to read.

Before this change:

    $ ctr version
    Client:
      Version: v1.0.0-beta.2-132-g564600e.m
      Revision: 564600ee79aefb0f24cbcecc90d4388bd0ea59de.m

    Server:
      Version: v1.0.0-beta.2-132-g564600e.m
      Revision: 564600ee79aefb0f24cbcecc90d4388bd0ea59de.m

With this patch applied:

    $ ctr version
    Client:
      Version:  v1.0.0-beta.2-132-g564600e.m
      Revision: 564600ee79aefb0f24cbcecc90d4388bd0ea59de.m

    Server:
      Version:  v1.0.0-beta.2-132-g564600e.m
      Revision: 564600ee79aefb0f24cbcecc90d4388bd0ea59de.m

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-11-03 17:49:23 +01:00
Stephen J Day
0a1a13448b
defaults: add package to contain server defaults
To reduce the binary size of containerd, we no longer import the
`server` package for only a few defaults. This reduces the size of `ctr`
by 2MB. There are probably other gains elsewhere.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-02 13:59:34 -07:00
Jess Valarezo
864b16a2cb ctr: alphabetize commands, rename signals
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-31 11:57:49 -07:00
Jess Valarezo
f654b7b71e ctr: move pprof to commands package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-31 11:57:49 -07:00
Jess Valarezo
a827a17f1d ctr: move shim to commands
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-31 11:57:49 -07:00
Jess Valarezo
c3b70f1d0b ctr: move tasks, run to commands package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-31 11:57:41 -07:00
Phil Estes
ff904841f9
Merge pull request #1668 from jessvalarezo/image-unpack-check
client: Add helper function which checks if an image is unpacked
2017-10-31 10:23:08 -04:00
Phil Estes
9f5b97c510
Merge pull request #1698 from crosbymichael/task-ls
Move task list to separate command
2017-10-30 21:30:02 -04:00
Phil Estes
8bbf8d892a
Merge pull request #1693 from jessvalarezo/ctr-refactor-fourth-pass
ctr: move more commands
2017-10-30 21:29:24 -04:00
Jess Valarezo
1552ee23da client: Add helper function which checks if an image is unpacked
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-30 16:33:54 -07:00
Jess Valarezo
7a1d709cc9 ctr: remove apply command
* in its current state, apply command should not be in ctr

Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-30 14:46:44 -07:00
Jess Valarezo
e4da49c44c ctr: move unpack to snapshot command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-30 13:23:36 -07:00
Jess Valarezo
456d3f4475 ctr: move push and pull to images command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-30 13:23:36 -07:00
Jess Valarezo
b58e4fc2ed ctr: move fetch,fetch-object,push-object to content
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-30 13:23:06 -07:00
Michael Crosby
91597bc6c3 Move task list to separate command
This keeps the semantics the same as the other commands to only list
containers, tasks, images by calling the list subcommand.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-30 15:01:00 -04:00
Michael Crosby
b93bd0cfec
Merge pull request #1676 from AkihiroSuda/null-io-fix
ctr: error if tty && nullIO
2017-10-30 10:10:22 -04:00
Akihiro Suda
e0da28acc4 ctr: error if tty && nullIO
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-10-29 23:58:57 +09:00
Jess Valarezo
16855eedf7 ctr: move resolver to commands package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-26 16:31:58 -04:00
Jess Valarezo
ffd0d2ef58 ctr: move signals to commands package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-26 16:31:23 -04:00
Jess Valarezo
8540587b37 ctr: move events command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 22:21:57 -04:00
Jess Valarezo
fdb6859921 ctr: move namespaces command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 22:00:14 -04:00
Jess Valarezo
750fd89b38 ctr: move snapshot command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 21:23:41 -04:00
Jess Valarezo
0895dbe932 ctr: move content command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 21:16:44 -04:00
Jess Valarezo
f980cc197e ctr: move images command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 21:08:00 -04:00
Jess Valarezo
47fae4dd17 ctr: move containers command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 21:07:54 -04:00
Michael Crosby
ae995bc7b3 Move plugins command
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 11:22:59 -04:00
Michael Crosby
2dac1b6963 Move version command into package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 11:14:09 -04:00
Michael Crosby
4743f1fc4c Move NewClient and AppContext to commands pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 11:10:00 -04:00
Jess Valarezo
a19a20303a ctr: add commands package with shared utility functions
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-23 17:40:18 -07:00
Michael Crosby
9f76083a8f Refactor newClient in ctr
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-23 13:38:15 -04:00
Michael Crosby
edf4114d55 Merge pull request #1673 from qingyunha/ctr
ctr use client's underlying service
2017-10-23 10:42:25 -04:00
Tao Qingyun
61121024c1 ctr use client's underlying service
Signed-off-by: Tao Qingyun <845767657@qq.com>
2017-10-23 20:22:54 +08:00
Michael Crosby
c7dc795455 [ctr] add --detach to run
This allows the user to detach from the container after it has started.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-19 15:13:38 -04:00
Michael Crosby
2e004086cf [ctr] Add --null-io to ctr run/start
This allows all task io to be redirected to /dev/null

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-19 15:01:33 -04:00
Michael Crosby
e4c6bf3b5e Remove default filter from ctr
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-17 17:10:03 -04:00
Michael Crosby
e201be5196 Create checkpointed image in client
Allow a user provided name for the checkpoint as well as a default
generated name for the checkpoint image.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-17 15:12:04 -04:00
Jacob Wen
abbec62620 cmd/ctr: create an image for checkpoint
This allows one to manage the checkpoints by using the `ctr image`
command.

The image is created with label "containerd.io/checkpoint". By
default, it is not included in the output of `ctr images ls`.
We can list the images by using the following command:
$ ctr images ls labels.containerd.\"io/checkpoint\"==true

Fixes #1026

Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
2017-10-17 11:25:37 -04:00
Derek McGowan
e378196505
Add snapshot label command to ctr
Allows easier debugging of snapshots using labels

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-10-16 11:54:01 -07:00
Jess Valarezo
830e0ea339 Change hcsshimopts to hcsshimtypes package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-11 11:42:07 -07:00
Derek McGowan
d9db1d112d
Refactor differ into separate package
Add differ options and package with interface.
Update optional values on diff interface to use options.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-10-11 10:02:29 -07:00
Stephen J Day
0e72ce5c5b
services/introspection: implement plugin reporting
With this change, we integrate all the plugin changes into the
introspection service.

All plugins can be listed with the following command:

```console
$ ctr plugins
TYPE                            ID             PLATFORM       STATUS
io.containerd.content.v1        content        -              ok
io.containerd.metadata.v1       bolt           -              ok
io.containerd.differ.v1         walking        linux/amd64    ok
io.containerd.grpc.v1           containers     -              ok
io.containerd.grpc.v1           content        -              ok
io.containerd.grpc.v1           diff           -              ok
io.containerd.grpc.v1           events         -              ok
io.containerd.grpc.v1           healthcheck    -              ok
io.containerd.grpc.v1           images         -              ok
io.containerd.grpc.v1           namespaces     -              ok
io.containerd.snapshotter.v1    btrfs          linux/amd64    error
io.containerd.snapshotter.v1    overlayfs      linux/amd64    ok
io.containerd.grpc.v1           snapshots      -              ok
io.containerd.monitor.v1        cgroups        linux/amd64    ok
io.containerd.runtime.v1        linux          linux/amd64    ok
io.containerd.grpc.v1           tasks          -              ok
io.containerd.grpc.v1           version        -              ok
```

There are few things to note about this output. The first is that it is
printed in the order in which plugins are initialized. This useful for
debugging plugin initialization problems. Also note that even though the
introspection GPRC api is a itself a plugin, it is not listed. This is
because the plugin takes a snapshot of the initialization state at the
end of the plugin init process. This allows us to see errors from each
plugin, as they happen. If it is required to introspect the existence of
the introspection service, we can make modifications to include it in
the future.

The last thing to note is that the btrfs plugin is in an error state.
This is a common state for containerd because even though we load the
plugin, most installations aren't on top of btrfs and the plugin cannot
be used. We can actually view this error using the detailed view with a
filter:

```console
$ ctr plugins --detailed id==btrfs
Type:          io.containerd.snapshotter.v1
ID:            btrfs
Platforms:     linux/amd64
Exports:
               root      /var/lib/containerd/io.containerd.snapshotter.v1.btrfs
Error:
               Code:        Unknown
               Message:     path /var/lib/containerd/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter
```

Along with several other values, this is a valuable tool for evaluating the
state of components in containerd.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-10-10 17:29:24 -07:00
Jess
061c719209 ListPids returns process ID and other info
Signed-off-by: Jess <jessica.valarezo@docker.com>
2017-10-10 22:57:15 +00:00
Michael Crosby
fa9e9bdf46 Fetch current container info before operations
This makes sure the client is always in sync with the server before
performing any type of operations on the container metadata.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-04 15:29:57 -04:00
Kenfe-Mickaël Laventure
ec43dc2b46 Merge pull request #1592 from AkihiroSuda/workdir2
ctr run: add --cwd
2017-10-04 09:17:21 -07:00
Akihiro Suda
b26e2e781c ctr run: add --cwd
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-10-04 04:40:08 +00:00
Stephen J Day
c555df54c0
images: support checking status of image content
The `Check` function returns information about an image's content components
over a content provider. From this information, one can tell which content is
required, present or missing to run an image.

The utility can be demonstrated with the `check` command:

```console
$ ctr images check
REF                               TYPE                                                      DIGEST                                                                  STATUS            SIZE
docker.io/library/alpine:latest   application/vnd.docker.distribution.manifest.list.v2+json sha256:f006ecbb824d87947d0b51ab8488634bf69fe4094959d935c0c103f4820a417d incomplete (1/2)  1.5 KiB/1.9 MiB
docker.io/library/postgres:latest application/vnd.docker.distribution.manifest.v2+json      sha256:2f8080b9910a8b4f38ff5a55a82e77cb43d88bdbb16d723c71d18493590832e9 complete (13/13)  99.3 MiB/99.3 MiB
docker.io/library/redis:alpine    application/vnd.docker.distribution.manifest.v2+json      sha256:e633cded055a94202e4ccccb8125b7f383cd6ee56527ab890db643383a2647dd incomplete (6/7)  8.1 MiB/10.0 MiB
docker.io/library/ubuntu:latest   application/vnd.docker.distribution.manifest.list.v2+json sha256:60f835698ea19e8d9d3a59e68fb96fb35bc43e745941cb2ea9eaf4ba3029ed8a unavailable (0/?) 0.0 B/?
docker.io/trollin/busybox:latest  application/vnd.docker.distribution.manifest.list.v2+json sha256:54a6424f7a2d5f4f27b3d69e5f9f2bc25fe9087f0449d3cb4215db349f77feae complete (2/2)    699.9 KiB/699.9 KiB
```

The above shows us that we have two incomplete images and one that is
unavailable. The incomplete images are those that we know the complete
size of all content but some are missing. "Unavailable" means that the
check could not get enough information about the image to get its full
size.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-10-03 15:19:22 -07:00
Michael Crosby
33e974ce99 Merge pull request #1577 from crosbymichael/lint-1
Update files based on go lint
2017-10-02 10:57:19 -04:00
Michael Crosby
f43b7acfd2 Update files based on go lint
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-02 10:15:28 -04:00
Tobias Klauser
727fd599fb ctr: remove SIGUNUSED from signal map
The SIGUNUSED constant was removed from golang.org/x/sys/unix in
https://go-review.googlesource.com/61771 as it is also removed from the
respective glibc headers.

This means the command

  ctr tasks kill SIGUNUSED ...

will no longer work. However, the same effect can be achieved with

  ctr tasks kill SIGSYS ...

as SIGSYS has the same value as SIGUNUSED used to have.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-10-02 15:10:31 +02:00
Akihiro Suda
27023c7fa2 readonly: pass RW rootfs to runtime, and let the runtime remount it as RO
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-09-29 06:20:26 +00:00
Kenfe-Mickael Laventure
df82159f4d
client: Allow setting image labels on Pull() and Import()
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-09-27 15:05:34 -07:00
Akihiro Suda
2a648136a9 ctr: add ctr images ls --quiet
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-09-26 09:43:10 +00:00
Stephen Day
df896c92e7 Merge pull request #1528 from jessvalarezo/labels-validate
Labels are consistently validated across services.
2017-09-22 10:33:17 -07:00
Allen Sun
d5b027c94b make command help display consistent
Signed-off-by: Allen Sun <shlallen1990@gmail.com>
2017-09-22 15:44:26 +08:00
Jess Valarezo
18c4322bb3 Labels are consistently validated across services
* The combined size of a key/value pair cannot exceed 4096 bytes

Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-09-21 15:11:46 -07:00
Derek McGowan
eef47ffad3
Add platform filtering on children handler
Fixes pulling of multi-arch images by limiting the expansion
of the index by filtering to the current default platform.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-09-20 15:18:18 -07:00
Phil Estes
ef5f2025aa Merge pull request #1533 from stevvooe/specifier-default
platforms: provide simpler function for common use
2017-09-20 15:15:12 -04:00
Stephen J Day
9163377123
platforms: provide simpler function for common use
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-20 11:56:59 -07:00
Michael Crosby
d22160c28e Vendor typeurl package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-09-19 09:43:55 -04:00
Derek McGowan
46ded63f2d
Support for multi-arch image unpacking
Resolves the platform on multi-arch manifests during unpack and config resolving.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-09-14 09:32:37 -07:00
Stephen J Day
ea8adf9021
cmd/ctr: show resolved image platform
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-13 12:41:55 -07:00
Michael Crosby
2cfd7df257 Merge pull request #1456 from ijc/ctr-list-no-labels
ctr: drop labels from `ctr containers` subcommand list
2017-09-07 11:07:05 -04:00
Kenfe-Mickaël Laventure
e1eeb0e0a2 Merge pull request #1475 from dmcgowan/content-commit-context
Add context to content commit
2017-09-06 11:04:31 -07:00
Derek McGowan
9613acb2ed
Add context to content commit
Content commit is updated to take in a context, allowing
content to be committed within the same context the writer
was in. This is useful when commit may be able to use more
context to complete the action rather than creating its own.
An example of this being useful is for the metadata implementation
of content, having a context allows tests to fully create
content in one database transaction by making use of the context.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-09-06 10:19:12 -07:00
Stephen Day
378e3343fe Merge pull request #1362 from AkihiroSuda/ctr-snapshot-info
ctr: add `ctr snapshot info <key>`
2017-09-01 14:25:25 -07:00
Michael Crosby
5614e9c7b3 Wait on exec process not task
Fixes #1449

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-09-01 11:51:45 -04:00
Akihiro Suda
053deb5ce2 ctr: net-host: bind-mount host /etc/{hosts,resolv.conf}
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-09-01 07:16:31 +00:00
Akihiro Suda
fef7f3addc ctr: add ctr snapshot info <key>
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-09-01 04:41:34 +00:00
Ian Campbell
94b0d0ecd0 ctr: drop labels from ctr containers subcommand list
The labels can be very long (e.g. cri-containerd stores a large JSON metadata
blob as `io.cri-containerd.container.metadata`) which renders the output
useless due to all the line wrapping etc.

The information is still available in `ctr containers info «name»`.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-08-31 23:42:21 +01:00
Kenfe-Mickael Laventure
42b131c1f3
Allow setting runtime options when using WithRuntime()
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-29 10:03:51 -07:00
Michael Crosby
ed6b8fb0aa Add KillOpts for killing all processes
Fixes #1431

This adds KillOpts so that a client can specify when they want to kill a
single process or all the processes inside a container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-28 13:29:47 -04:00
Michael Crosby
f66f0fb7a0 Update windows SpecOpts in tests
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-24 10:32:16 -04:00
Michael Crosby
c601606f84 Move spec generation to Container Create
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-24 10:32:16 -04:00
Michael Crosby
fa14f2ef3a Add context and client to SpecOpts
In order to do more advanced spec generation with images, snapshots,
etc, we need to inject the context and client into the spec generation
code.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-24 10:32:16 -04:00
Kenfe-Mickael Laventure
7f6c487031
go-client: Return an ExitStatus struct when calling process.Delete()
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-23 10:32:51 -07:00
Phil Estes
4712ed5390
Fix snapshot ctr command to use default
After the rework of server-side defaults, the `ctr snapshot` command
stopped working due to no default snapshotter.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2017-08-22 11:54:37 -07:00
Brian Goff
6ab99edb71 Convert ExitStatus to use fn to get details
Instead of requiring callers to read the struct fields to check for an
error, provide the exit results via a function instead which is more
natural.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-08-22 10:48:44 -04:00
Brian Goff
026896ac4c Make Wait() async
In all of the examples, its recommended to call `Wait()` before starting
a process/task.
Since `Wait()` is a blocking call, this means it must be called from a
goroutine like so:

```go
statusC := make(chan uint32)
go func() {
  status, err := task.Wait(ctx)
  if err != nil {
    // handle async err
  }

  statusC <- status
}()

task.Start(ctx)
<-statusC
```

This means there is a race here where there is no guarentee when the
goroutine is going to be scheduled, and even a bit more since this
requires an RPC call to be made.
In addition, this code is very messy and a common pattern for any caller
using Wait+Start.

Instead, this changes `Wait()` to use an async model having `Wait()`
return a channel instead of the code itself.
This ensures that when `Wait()` returns that the client has a handle on
the event stream (already made the RPC request) before returning and
reduces any sort of race to how the stream is handled by grpc since we
can't guarentee that we have a goroutine running and blocked on
`Recv()`.

Making `Wait()` async also cleans up the code in the caller drastically:

```go
statusC, err := task.Wait(ctx)
if err != nil {
  return err
}

task.Start(ctx)

status := <-statusC
if status.Err != nil {
  return err
}
```

No more spinning up goroutines and more natural error
handling for the caller.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-08-22 09:33:07 -04:00
Zhang Wei
14fe2d5f20 Add newline char to avoid mix of logs
Add a '\n' after "unpacking xxx..." to avoid mix of logs such as:

```
unpacking sha256:a7776895af32e34b1fef997e26c79fa988b40c5cf2a3fb48dc22e0584b648d82...DEBU[0005]
Extraction not needed, layer snapshot exists
DEBU[0005] Extraction not needed, layer snapshot exists
DEBU[0005] Extraction not needed, layer snapshot exists
DEBU[0005] Extraction not needed, layer snapshot exists
DEBU[0005] Extraction not needed, layer snapshot exists
DEBU[0005] Extraction not needed, layer snapshot exists
done
```

After this commit:

```
unpacking sha256:a7776895af32e34b1fef997e26c79fa988b40c5cf2a3fb48dc22e0584b648d82...
DEBU[0008] Extraction not needed, layer snapshot exists
DEBU[0008] Extraction not needed, layer snapshot exists
DEBU[0008] Extraction not needed, layer snapshot exists
DEBU[0008] Extraction not needed, layer snapshot exists
DEBU[0008] Extraction not needed, layer snapshot exists
DEBU[0008] Extraction not needed, layer snapshot exists
done
```

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2017-08-20 21:03:18 +08:00
Akihiro Suda
e03ecd30a7 ctr: add ctr snapshot view
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-08-16 08:40:11 +00:00
Akihiro Suda
ca352220b5 ctr: fix ctr snapshot commit
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-08-15 08:14:54 +00:00
Michael Crosby
a888587cc4 Set runtime on container from ctr
Set the missing `--runtime` flag when using ctr for new containers

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-10 11:38:36 -04:00
Michael Crosby
17d7a5c65b Merge pull request #1321 from stevvooe/refactor-snapshot-commands
cmd/snapshot: follow conventions from Snapshotter
2017-08-10 10:08:38 -04:00
Stephen J Day
cea1d337c2
cmd/snapshot: follow conventions from Snapshotter
The argument order, naming and behavior of the snapshots command didn't
really follow any of the design constraints or conventions of the
`Snapshotter` interface. This brings the command into line with that
interface definition.

The `snapshot archive` command has been removed as it requires more
thought on design to correctly emit diffs.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-08-09 17:22:33 -07:00
Stephen Day
e6ba48f25c Merge pull request #1257 from stevvooe/content-changes
content: remove Provider.Reader
2017-08-09 17:12:44 -07:00
Stephen J Day
8be340e37b
content: remove Provider.Reader
After some analysis, it was found that Content.Reader was generally
redudant to an io.ReaderAt. This change removes `Content.Reader` in
favor of a `Content.ReaderAt`. In general, `ReaderAt` can perform better
over interfaces with indeterminant latency because it avoids remote
state for reads. Where a reader is required, a helper is provided to
convert it into an `io.SectionReader`.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-08-09 14:32:28 -07:00
Tobias Klauser
4a6a2b9db0 Switch from package syscall to golang.org/x/sys
The syscall package is locked down and the comment in [1] advises to
switch code to use the corresponding package from golang.org/x/sys. Do
so and replace usage of package syscall with package
golang.org/x/sys/{unix,windows} where applicable.

  [1] https://github.com/golang/go/blob/master/src/syscall/syscall.go#L21-L24

This will also allow to get updates and fixes for syscall wrappers
without having to use a new go version.

Errno, Signal and SysProcAttr aren't changed as they haven't been
implemented in x/sys/. Stat_t from syscall is used if standard library
packages (e.g. os) require it. syscall.ENOTSUP, syscall.SIGKILL and
syscall.SIGTERM are used for cross-platform files.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-08-09 13:41:16 +02:00
Phil Estes
8ebbd1cdf9
Delete command should require at least one container ID
Also fix help/usage to reveal delete accepts multiple container IDs.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2017-08-08 11:13:23 -04:00
Derek McGowan
738c22a756 Merge pull request #1299 from crosbymichael/ctr
Update ctr containers and tasks command
2017-08-07 13:32:03 -07:00
Michael Crosby
2fb2168bae Merge pull request #1224 from epilatow/solaris.cc.20170719.0
Add solaris build support
2017-08-07 16:15:07 -04:00
Edward Pilatowicz
56c1f5c184 Add solaris build support
Signed-off-by: Edward Pilatowicz <edward.pilatowicz@oracle.com>
2017-08-07 12:40:21 -07:00
Michael Crosby
00288bcb58 Update ctr containers and tasks command
This moves container and tasks commands under the containers and tasks
top level commands.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-07 14:45:21 -04:00
Michael Crosby
b20fd92a13 Merge pull request #1298 from miaoyq/add-start-cmd
Add `start` subcommand in `ctr`.
2017-08-07 10:21:35 -04:00
Michael Crosby
60f7eee27b Merge pull request #1275 from mlaventure/travis-ineffassign
Enable ineffassign in CI
2017-08-07 09:21:53 -04:00
Yanqiang Miao
ac72bbab26 Add start subcommand in ctr.
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-08-05 09:39:11 +08:00
Michael Crosby
de7afd8aa8 Merge pull request #1293 from dmcgowan/fix-snapshotter-run
Fix ctr run bug when snapshotter is provided
2017-08-04 17:07:49 -04:00
Derek McGowan
5a74a46d42
Fix bug where snapshots got created with wrong snapshotter
Snapshotters for run must be created with requested snapshotter.
The order of the options is important to ensure that the snapshotter
is set before the snapshots are created.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-04 13:32:33 -07:00
Kenfe-Mickael Laventure
16f6e0944a
Do not touch grpc logger from within the packages
Libraries should not make process wide changes unless requested to.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-04 10:11:46 -07:00
Phil Estes
7e0063320c Merge pull request #1282 from AkihiroSuda/dismiss-progressbar-on-debug
ctr: dismiss progressbar on --debug
2017-08-04 11:51:17 -04:00
Michael Crosby
9f13b414b9 Return exit status from Wait of stopped process
This changes Wait() from returning an error whenever you call wait on a
stopped process/task to returning the exit status from the process.

This also adds the exit status to the Status() call on a process/task so
that a user can Wait(), check status, then cancel the wait to avoid
races in event handling.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-03 17:22:33 -04:00
Kenfe-Mickael Laventure
829845d268
Fix ineffassign warnings
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-03 08:27:15 -07:00
Akihiro Suda
b45fb98530 ctr: dismiss progressbar on --debug
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-08-03 09:35:52 +00:00
Michael Crosby
63878d14ea Add create/start to exec processes in shim
This splits up the create and start of an exec process in the shim to
have two separate steps like the initial process.  This will allow
better state reporting for individual process along with a more robust
wait for execs.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-02 13:50:08 -04:00
Stephen J Day
af2d7f0e55
events: initial support for filters
This change further plumbs the components required for implementing
event filters. Specifically, we now have the ability to filter on the
`topic` and `namespace`.

In the course of implementing this functionality, it was found that
there were mismatches in the events API that created extra serialization
round trips. A modification to `typeurl.MarshalAny` and a clear
separation between publishing and forwarding allow us to avoid these
serialization issues.

Unfortunately, this has required a few tweaks to the GRPC API, so this
is a breaking change. `Publish` and `Forward` have been clearly separated in
the GRPC API. `Publish` honors the contextual namespace and performs
timestamping while `Forward` simply validates and forwards. The behavior
of `Subscribe` is to propagate events for all namespaces unless
specifically filtered (and hence the relation to this particular change.

The following is an example of using filters to monitor the task events
generated while running the [bucketbench tool](https://github.com/estesp/bucketbench):

```
$ ctr events 'topic~=/tasks/.+,namespace==bb'
...
2017-07-28 22:19:51.78944874 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-6-8","pid":25889}
2017-07-28 22:19:51.791893688 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-4-8","pid":25882}
2017-07-28 22:19:51.792608389 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-2-9","pid":25860}
2017-07-28 22:19:51.793035217 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-5-6","pid":25869}
2017-07-28 22:19:51.802659622 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-0-7","pid":25877}
2017-07-28 22:19:51.805192898 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-3-6","pid":25856}
2017-07-28 22:19:51.832374931 +0000 UTC   bb        /tasks/exit   {"container_id":"bb-ctr-8-6","id":"bb-ctr-8-6","pid":25864,"exited_at":"2017-07-28T22:19:51.832013043Z"}
2017-07-28 22:19:51.84001249 +0000 UTC   bb        /tasks/exit   {"container_id":"bb-ctr-2-9","id":"bb-ctr-2-9","pid":25860,"exited_at":"2017-07-28T22:19:51.839717714Z"}
2017-07-28 22:19:51.840272635 +0000 UTC   bb        /tasks/exit   {"container_id":"bb-ctr-7-6","id":"bb-ctr-7-6","pid":25855,"exited_at":"2017-07-28T22:19:51.839796335Z"}
...
```

In addition to the events changes, we now display the namespace origin
of the event in the cli tool.

This will be followed by a PR to add individual field filtering for the
events API for each event type.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-31 12:53:18 -07:00
Stephen Day
20fa6aee2e Merge pull request #1182 from AkihiroSuda/rootfs
client, ctr: allow specifying unmanaged rootfs dir
2017-07-28 10:56:25 -07:00
Michael Crosby
183a6ca888 Merge pull request #1013 from AkihiroSuda/oci-export
client: add Import() and Export() for importing/exporting image in OCI format
2017-07-28 09:22:22 -04:00
Akihiro Suda
b518f11dba client: add Import() and Export() for importing/exporting image in OCI format
Export as a tar (Note: "-" can be used for stdout):

    $ ctr images export /tmp/oci-busybox.tar docker.io/library/busybox:latest

Import a tar (Note: "-" can be used for stdin):

    $ ctr images import foo/new:latest /tmp/oci-busybox.tar

Note: media types are not converted at the moment: e.g.
  application/vnd.docker.image.rootfs.diff.tar.gzip
  -> application/vnd.oci.image.layer.v1.tar+gzip

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-07-28 04:47:53 +00:00
Akihiro Suda
752d253f40 client, ctr: allow specifying unmanaged rootfs dir
e.g. ctr run -t --rm --rootfs /tmp/busybox-rootfs foo /bin/sh
(--rm removes the container but does not remove rootfs dir, of course)

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-07-28 04:45:04 +00:00
Stephen J Day
83ac874886
cmd/ctr: allow deleting multiple containers at once
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-27 15:30:35 -07:00
Michael Crosby
b84817a29c Merge pull request #1246 from stevvooe/events-refactor
events: refactor event distribution
2017-07-26 08:31:12 -04:00
Derek McGowan
73bec3edea
client: rename rootfs to snapshot in "With" functions
Clarify terminology around functions which use and create
snapshots for containers.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-25 15:24:06 -07:00
Stephen J Day
a615a6fe5d
events: refactor event distribution
In the course of setting out to add filters and address some cleanup, it
was found that we had a few problems in the events subsystem that needed
addressing before moving forward.

The biggest change was to move to the more standard terminology of
publish and subscribe. We make this terminology change across the Go
interface and the GRPC API, making the behavior more familier. The
previous system was very context-oriented, which is no longer required.

With this, we've removed a large amount of dead and unneeded code. Event
transactions, context storage and the concept of `Poster` is gone. This
has been replaced in most places with a `Publisher`, which matches the
actual usage throughout the codebase, removing the need for helpers.

There are still some questions around the way events are handled in the
shim. Right now, we've preserved some of the existing bugs which may
require more extensive changes to resolve correctly.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-25 15:08:09 -07:00
Stephen J Day
863784f991
snapshot: replace "readonly" with View snapshot type
What started out as a simple PR to remove the "Readonly" column became an
adventure to add a proper type for a "View" snapshot. The short story here is
that we now get the following output:

```
$ sudo ctr snapshot ls
ID 									 PARENT 								 KIND
sha256:08c2295a7fa5c220b0f60c994362d290429ad92f6e0235509db91582809442f3 								  	 Committed
testing4								 sha256:08c2295a7fa5c220b0f60c994362d290429ad92f6e0235509db91582809442f3 Active
```

In pursuing this output, it was found that the idea of having "readonly" as an
attribute on all snapshots was redundant. For committed, they are always
readonly, as they are not accessible without an active snapshot. For active
snapshots that were views, we'd have to check the type before interpreting
"readonly". With this PR, this is baked fully into the kind of snapshot. When
`Snapshotter.View` is  called, the kind of snapshot is `KindView`, and the
storage system reflects this end to end.

Unfortunately, this will break existing users. There is no migration, so they
will have to wipe `/var/lib/containerd` and recreate everything. However, this
is deemed worthwhile at this point, as we won't have to judge validity of the
"Readonly" field when new snapshot types are added.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-24 16:58:01 -07:00
Derek McGowan
1491293260
Update dependencies for logrus rename
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-21 16:14:03 -07:00
Andrew Pennebaker
1d2a079f08
update to github.com/sirupsen/logrus v1.0.0
Signed-off-by: Andrew Pennebaker <apennebaker@datapipe.com>
2017-07-21 15:39:14 -07:00
Stephen Day
dd7642fc1c Merge pull request #1196 from mlaventure/update-windows-runtime
Update windows runtime
2017-07-21 15:12:53 -07:00
Kenfe-Mickael Laventure
8e12d1fcad
ctr: Allow deleting a container in the Created state
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-21 18:19:51 +02:00
Kenfe-Mickael Laventure
4bb9ac2828
Sort ctr commands alphabetically
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-21 18:19:51 +02:00
Kenfe-Mickael Laventure
d0166c42ce
Register content command with ctr
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-21 18:19:51 +02:00
Kenfe-Mickael Laventure
a4aaa09ccc
Update ctr so it works again on windows
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-21 18:19:48 +02:00
Sunny Gogoi
912ddbae0f cmd/ctr: add commit command to snapshot
Signed-off-by: Sunny Gogoi <me@darkowlzz.space>
2017-07-20 04:17:15 +05:30
Sunny Gogoi
4dc02c09e7 cmd/ctr: add mount subcmd to snapshot & a flag in prepare
This changeset:
- adds `mount` subcommand to `ctr snapshot`
- adds `snapshot-name` flag for specifying target snapshot name in both `mount`
and `prepare` snapshot subcommands

Signed-off-by: Sunny Gogoi <me@darkowlzz.space>
2017-07-19 14:47:35 +05:30
Stephen Day
8d19513267 Merge pull request #1195 from darkowlzz/tree
cmd/ctr: add tree subcommand in snapshot
2017-07-18 18:14:07 -07:00
rajasec
728f8accc6 Fixing return error on run command
Signed-off-by: rajasec <rajasec79@gmail.com>

Updating the usage and errors for ctr run command

Signed-off-by: rajasec <rajasec79@gmail.com>

Updating the usage of run command

Signed-off-by: rajasec <rajasec79@gmail.com>

Reverting back the imports

Signed-off-by: rajasec <rajasec79@gmail.com>
2017-07-19 21:31:27 +05:30
Sunny Gogoi
659e3d789c cmd/ctr: add tree subcommand in snapshot
Signed-off-by: Sunny Gogoi <me@darkowlzz.space>
2017-07-18 09:38:40 +05:30
Stephen J Day
778b1f1c0c
cmd/ctr: container list should not look up image
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-17 14:51:36 -07:00
Akihiro Suda
a0664b5ce5 comment: dist -> ctr
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-07-16 14:45:56 +00:00
Stephen J Day
98f6deb50e cmd/dist: completely remove dist command
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-14 15:48:39 -07:00
Stephen J Day
1db80ed966
cmd/{ctr, dist}: move content command to ctr
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-14 15:31:36 -07:00
Stephen J Day
f7306d7f6c
cmd/{ctr,dist}: move images command to ctr
Rather than make a large PR, we can move parts of the dist commands over
piece by piece. This first step moves over the images command. Others
will follow.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-14 14:50:02 -07:00
Stephen J Day
a8b2254911
cmd/{ctr,dist}: label can be a verb
Rather than using the more verbose `set-labels` command, we are changing
the command to set labels for various objects to `label`, as it can be
used as a verb. This matches changes in the content store labeling.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-13 14:36:13 -07:00
Stephen J Day
b385798695
containerd: remove GRPC service export
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-12 16:57:47 -07:00
Michael Crosby
3b8018d8cf Remove protos from Go client API
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-12 14:32:37 -07:00
Derek McGowan
1a49f5ea79 Merge pull request #1167 from crosbymichael/multi-ss
support using multiple snapshotters simultaneously
2017-07-12 13:34:31 -07:00
Akihiro Suda
b06aab713a support using multiple snapshotters simultaneously
e.g. dist pull --snapshotter btrfs ...; ctr run --snapshotter btrfs ...
(empty string defaults for overlayfs)

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-12 11:16:12 -07:00
Michael Crosby
2b6d790ff4 Refactor runtime events into Task* types
This removes the RuntimeEvent super proto with enums into separate
runtime event protos to be inline with the other events that are output
by containerd.

This also renames the runtime events into Task* events.

Fixes #1071

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-12 10:57:57 -07:00
Michael Crosby
4e8943f7bb Update runtime-spec rc6
This should be the same commit tagged as the 1.0 release

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-12 09:32:41 -07:00
Sunny Gogoi
2c1b54f573 cmd/ctr: add prepare subcommand to snapshot
This changeset adds `prepare` subcommand to `ctr snapshot` and removes
`prepare` from `dist rootfs` to keep the basic snapshot operation commands
together.

Signed-off-by: Sunny Gogoi <me@darkowlzz.space>
2017-07-11 21:30:40 +05:30
Sunny Gogoi
99461053f3 cmd/ctr: info marshal Container proto struct
Marshaling Container interface resulted in empty json. Use Container proto
struct to get proper container attributes.

Signed-off-by: Sunny Gogoi <me@darkowlzz.space>
2017-07-09 18:20:21 +05:30
Michael Crosby
f93bfb6233 Add Exec IDs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-06 15:23:08 -07:00
Michael Crosby
448dc0dfa8 Replace events/convert with typeurl
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-05 16:05:49 -07:00
Michael Crosby
a60511d5aa Use typeurl package for spec types
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-05 15:37:26 -07:00
Stephen J Day
396d89e423
cmd/ctr, service/containers: implement container filter
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-30 11:49:16 -07:00
Kenfe-Mickael Laventure
ccbe92dc08 Move WithExit to runcopts package
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-29 15:50:39 -07:00
Michael Crosby
82d0208aaa Implement options for runtime specific settings
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-29 15:32:45 -07:00
Stephen J Day
a4fadc596b
errdefs: centralize error handling
Now that we have most of the services required for use with containerd,
it was found that common patterns were used throughout services. By
defining a central `errdefs` package, we ensure that services will map
errors to and from grpc consistently and cleanly. One can decorate an
error with as much context as necessary, using `pkg/errors` and still
have the error mapped correctly via grpc.

We make a few sacrifices. At this point, the common errors we use across
the repository all map directly to grpc error codes. While this seems
positively crazy, it actually works out quite well. The error conditions
that were specific weren't super necessary and the ones that were
necessary now simply have better context information. We lose the
ability to add new codes, but this constraint may not be a bad thing.

Effectively, as long as one uses the errors defined in `errdefs`, the
error class will be mapped correctly across the grpc boundary and
everything will be good. If you don't use those definitions, the error
maps to "unknown" and the error message is preserved.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-29 15:00:47 -07:00
Michael Crosby
cfcea71ab0 Update windows and darwin for spec changes
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-27 13:20:55 -07:00
Michael Crosby
49f9dc494f Update runc and runtime-spec dependencies
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-27 11:44:38 -07:00
Derek McGowan
7f9910d04e
Fix ctr delete to remove snapshot
Fix the behavior of removing snapshot on container delete.
Adds a flag to keep the snapshot if desired.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-06-26 13:38:08 -07:00
Kunal Kushwaha
16b10bb55d Runtime name printed correctly.
Runtime is not printed while container listing due to typo introduced
in #935.
This fixes the Typo.

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2017-06-26 11:46:32 +09:00
Kenfe-Mickael Laventure
de632b1084
ctr: add remove subcommand to snapshot
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-23 18:24:46 -07:00
Kenfe-Mickael Laventure
5a02ae929c
ctr: Properly delete snapshot if run is called with --rm
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-23 18:01:01 -07:00
Kenfe-Mickael Laventure
95afeb7831
containerd-shim: Use abstract namespace for the unix socket
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-23 17:48:08 -07:00
Michael Crosby
990536f2cc Move shim protos into linux pkg
This moves the shim's API and protos out of the containerd services
package and into the linux runtime package. This is because the shim is
an implementation detail of the linux runtime that we have and it is not
a containerd user facing api.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-23 16:21:47 -07:00
Michael Crosby
3b9d9dfa3e Fix error on doulbe Kill calls
This returns a typed error for calls to Kill when the process has
already finished.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-23 13:28:48 -07:00
Michael Crosby
8d9ccd646b Merge pull request #935 from kunalkushwaha/ctr-fix-914
Container list and Task List printed separately.
2017-06-23 13:16:07 -07:00
Stephen J Day
c05be46348
events: move types into service package
When using events, it was found to be fairly unwieldy with a number of
extra packages. For the most part, when interacting with the events
service, we want types of the same version of the service. This has been
accomplished by moving all events types into the events package.

In addition, several fixes to the way events are marshaled have been
included. Specifically, we defer to the protobuf type registration
system to assemble events and type urls, with a little bit sheen on top
of add a containerd.io oriented namespace.

This has resulted in much cleaner event consumption and has removed the
reliance on error prone type urls, in favor of concrete types.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-22 19:12:25 -07:00
Kenfe-Mickaël Laventure
2fdb8020c4 Merge pull request #1062 from stevvooe/versioned-services
*: version protobuf service packages
2017-06-22 07:38:09 -07:00
Stephen J Day
12a6beaeeb
*: update import paths to use versioned services
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-21 18:29:06 -07:00
Phil Estes
76697ac8cb Merge pull request #1060 from samuelkarp/namespace-from-env
namespaces: Export env var and default value
2017-06-21 20:49:33 -04:00
Samuel Karp
9190f98e9c namespaces: Export env var and default value
Signed-off-by: Samuel Karp <skarp@amazon.com>
2017-06-21 17:38:07 -07:00
Michael Crosby
e588b30637 Merge pull request #1058 from dmcgowan/snapshot-command
Update snapshot command in ctr
2017-06-21 17:31:02 -07:00
Derek McGowan
a3d5a818f6
Update snapshot command in ctr
Move existing snapshot command to archive subcommand of snapshot.
Add list command for listing snapshots.
Add usage command for showing snapshot disk usage.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-06-21 17:18:52 -07:00
Michael Crosby
235869eb1f Rename execution service to tasks
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-21 14:39:25 -07:00
Michael Crosby
8b2cf6e8e6 Fix Wait() on process/tasks
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-21 13:48:24 -07:00
Evan Hazlett
0b06fa8518 use event service for task wait
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-21 13:34:24 -07:00
Michael Crosby
94eafaab60 Update GRPC for consistency
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-21 13:34:24 -07:00
Kunal Kushwaha
a0f73ae229 Container list and Task List printed separately.
Fix for #914

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2017-06-21 10:26:49 +09:00
Michael Crosby
58367550e2 Merge pull request #1036 from crosbymichael/client-addr
Add DefaultAddress to client
2017-06-20 13:39:48 -07:00
Michael Crosby
9efe341f8e Add DefaultAddress to client
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-20 13:34:37 -07:00
Evan Hazlett
ab4181649b events: be nice to Sprintf
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-06-20 16:17:22 -04:00
Evan Hazlett
935645b03a events: add protos
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: update events package to include emitter and use envelope proto

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: add events service

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: enable events service and update ctr events to use events service

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

event listeners

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: helper func for emitting in services

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: improved cli for containers and tasks

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

create event envelope with poster

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: introspect event data to use for type url

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: use pb encoding; add event types

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: instrument content and snapshot services with events

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: instrument image service with events

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: instrument namespace service with events

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: add namespace support

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: only send events from namespace requested from client

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: switch to go-events for broadcasting

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-06-20 10:47:28 -04:00
Stephen J Day
5d13f8027c
cmd/{dist, ctr}: cleanup flushing and alignment
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-16 14:49:48 -07:00
Yanqiang Miao
b88b53212f Add 'ArgsUsage' for some ctr sub-cmds
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-06-15 16:04:11 +08:00
Michael Crosby
94e7f8e943 Setup plugin ids and dependencies
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-14 16:17:20 -07:00
Ian Campbell
e9559c6eed ctr: Remove getTempDir
It is unused since 4c1af8fdd8 ("Port ctr to use client") and leaving it
around will just tempt people into writing code with security holes.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-14 15:30:11 +01:00
Stephen J Day
27af417668
containerd: allow containers without an image
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-13 11:23:53 -07:00
Michael Crosby
ff598449d1 Add DeleteProcess API for removing execs
We need a separate API for handing the exit status and deletion of
Exec'd processes to make sure they are properly cleaned up within the
shim and daemon.

Fixes #973

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-12 09:32:23 -07:00
Michael Crosby
5d1669bcfb Add ctr attach for reattaching to running task
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-09 10:10:39 -07:00
Michael Crosby
4c1af8fdd8 Port ctr to use client
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-06 14:53:50 -07:00
Stephen J Day
af2718b01f
namespaces: support within containerd
To support multi-tenancy, containerd allows the collection of metadata
and runtime objects within a heirarchical storage primitive known as
namespaces. Data cannot be shared across these namespaces, unless
allowed by the service. This allows multiple sets of containers to
managed without interaction between the clients that management. This
means that different users, such as SwarmKit, K8s, Docker and others can
use containerd without coordination. Through labels, one may use
namespaces as a tool for cleanly organizing the use of containerd
containers, including the metadata storage for higher level features,
such as ACLs.

Namespaces

Namespaces cross-cut all containerd operations and are communicated via
context, either within the Go context or via GRPC headers. As a general
rule, no features are tied to namespace, other than organization. This
will be maintained into the future. They are created as a side-effect of
operating on them or may be created manually. Namespaces can be labeled
for organization. They cannot be deleted unless the namespace is empty,
although we may want to make it so one can clean up the entirety of
containerd by deleting a namespace.

Most users will interface with namespaces by setting in the
context or via the `CONTAINERD_NAMESPACE` environment variable, but the
experience is mostly left to the client. For `ctr` and `dist`, we have
defined a "default" namespace that will be created up on use, but there
is nothing special about it. As part of this PR we have plumbed this
behavior through all commands, cleaning up context management along the
way.

Namespaces in Action

Namespaces can be managed with the `ctr namespaces` subcommand. They
can be created, labeled and destroyed.

A few commands can demonstrate the power of namespaces for use with
images. First, lets create a namespace:

```
$ ctr namespaces create foo mylabel=bar
$ ctr namespaces ls
NAME LABELS
foo  mylabel=bar
```

We can see that we have a namespace `foo` and it has a label. Let's pull
an image:

```
$ dist pull docker.io/library/redis:latest
docker.io/library/redis:latest: resolved       |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:548a75066f3f280eb017a6ccda34c561ccf4f25459ef8e36d6ea582b6af1decf: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:d45bc46b48e45e8c72c41aedd2a173bcc7f1ea4084a8fcfc5251b1da2a09c0b6: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:5b690bc4eaa6434456ceaccf9b3e42229bd2691869ba439e515b28fe1a66c009: done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:a858478874d144f6bfc03ae2d4598e2942fc9994159f2872e39fae88d45bd847: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:4cdd94354d2a873333a205a02dbb853dd763c73600e0cf64f60b4bd7ab694875: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:10a267c67f423630f3afe5e04bbbc93d578861ddcc54283526222f3ad5e895b9: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:c54584150374aa94b9f7c3fbd743adcff5adead7a3cf7207b0e51551ac4a5517: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:d1f9221193a65eaf1b0afc4f1d4fbb7f0f209369d2696e1c07671668e150ed2b: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:71c1f30d820f0457df186531dc4478967d075ba449bd3168a3e82137a47daf03: done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 0.9 s total:   0.0 B (0.0 B/s)
INFO[0000] unpacking rootfs
INFO[0000] Unpacked chain id: sha256:41719840acf0f89e761f4a97c6074b6e2c6c25e3830fcb39301496b5d36f9b51
```

Now, let's list the image:

```
$ dist images ls
REF                            TYPE  DIGEST SIZE
docker.io/library/redis:latest application/vnd.docker.distribution.manifest.v2+json sha256:548a75066f3f280eb017a6ccda34c561ccf4f25459ef8e36d6ea582b6af1decf 72.7 MiB
```

That looks normal. Let's list the images for the `foo` namespace and see
this in action:

```
$ CONTAINERD_NAMESPACE=foo dist images ls
REF TYPE DIGEST SIZE
```

Look at that! Nothing was pulled in the namespace `foo`. Let's do the
same pull:

```
$ CONTAINERD_NAMESPACE=foo dist pull docker.io/library/redis:latest
docker.io/library/redis:latest: resolved       |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:548a75066f3f280eb017a6ccda34c561ccf4f25459ef8e36d6ea582b6af1decf: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:d45bc46b48e45e8c72c41aedd2a173bcc7f1ea4084a8fcfc5251b1da2a09c0b6: done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:a858478874d144f6bfc03ae2d4598e2942fc9994159f2872e39fae88d45bd847: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:4cdd94354d2a873333a205a02dbb853dd763c73600e0cf64f60b4bd7ab694875: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:c54584150374aa94b9f7c3fbd743adcff5adead7a3cf7207b0e51551ac4a5517: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:71c1f30d820f0457df186531dc4478967d075ba449bd3168a3e82137a47daf03: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:d1f9221193a65eaf1b0afc4f1d4fbb7f0f209369d2696e1c07671668e150ed2b: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:10a267c67f423630f3afe5e04bbbc93d578861ddcc54283526222f3ad5e895b9: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:5b690bc4eaa6434456ceaccf9b3e42229bd2691869ba439e515b28fe1a66c009: done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 0.8 s total:   0.0 B (0.0 B/s)
INFO[0000] unpacking rootfs
INFO[0000] Unpacked chain id: sha256:41719840acf0f89e761f4a97c6074b6e2c6c25e3830fcb39301496b5d36f9b51
```

Wow, that was very snappy! Looks like we pulled that image into out
namespace but didn't have to download any new data because we are
sharing storage. Let's take a peak at the images we have in `foo`:

```
$ CONTAINERD_NAMESPACE=foo dist images ls
REF                            TYPE DIGEST SIZE
docker.io/library/redis:latest application/vnd.docker.distribution.manifest.v2+json sha256:548a75066f3f280eb017a6ccda34c561ccf4f25459ef8e36d6ea582b6af1decf 72.7 MiB
```

Now, let's remove that image from `foo`:

```
$ CONTAINERD_NAMESPACE=foo dist images rm
docker.io/library/redis:latest
```

Looks like it is gone:

```
$ CONTAINERD_NAMESPACE=foo dist images ls
REF TYPE DIGEST SIZE
```

But, as we can see, it is present in the `default` namespace:

```
$ dist images ls
REF                            TYPE DIGEST SIZE
docker.io/library/redis:latest application/vnd.docker.distribution.manifest.v2+json sha256:548a75066f3f280eb017a6ccda34c561ccf4f25459ef8e36d6ea582b6af1decf 72.7 MiB
```

What happened here? We can tell by listing the namespaces to get a
better understanding:

```
$ ctr namespaces ls
NAME    LABELS
default
foo     mylabel=bar
```

From the above, we can see that the `default` namespace was created with
the standard commands without the environment variable set. Isolating
the set of shared images while sharing the data that matters.

Since we removed the images for namespace `foo`, we can remove it now:

```
$ ctr namespaces rm foo
foo
```

However, when we try to remove the `default` namespace, we get an error:

```
$ ctr namespaces rm default
ctr: unable to delete default: rpc error: code = FailedPrecondition desc = namespace default must be empty
```

This is because we require that namespaces be empty when removed.

Caveats

- While most metadata objects are namespaced, containers and tasks may
exhibit some issues. We still need to move runtimes to namespaces and
the container metadata storage may not be fully worked out.
- Still need to migrate content store to metadata storage and namespace
the content store such that some data storage (ie images).
- Specifics of snapshot driver's relation to namespace needs to be
worked out in detail.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-06 13:50:33 -07:00
Michael Crosby
35d74aa9d8 Merge pull request #803 from yuexiao-wang/fix-background
optimize for shim
2017-06-01 15:12:04 -07:00
yuexiao-wang
41308ffa57 optimize for shimCreateCommand
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2017-05-31 13:57:36 +08:00
Kenfe-Mickaël Laventure
0e56c47f8c Merge pull request #928 from AkihiroSuda/oci-rc6
vendor: OCI Image Spec v1.0.0-rc6
2017-05-30 10:09:28 -07:00
Michael Crosby
f55f40eeec Merge pull request #927 from miaoyq/fix-description-for-pprof
Fix the description of cmd 'pprof threadcreate'
2017-05-30 09:13:57 -07:00
Akihiro Suda
967a4e0e5a ctr shim exec: fix cli flag
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-27 14:54:38 +00:00
Akihiro Suda
f9039092c5 vendor: OCI Image Spec v1.0.0-rc6
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-27 12:27:14 +00:00
Yanqiang Miao
5c32d3871f Fix the description of cmd 'pprof threadcreate'
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-05-27 13:42:16 +08:00
Evan Hazlett
f42c762dc4
updates the execution service to include ContainerID in tasks
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-25 12:15:00 -04:00
Evan Hazlett
02fa534d71 ctr: enable specifying additional environment variables
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-24 18:24:31 -04:00
Ian Campbell
d7deba03a2 prepareStdio: use named return for err
This avoids issues with the various deferred error handlers in the event that
`err` is shadowed or named differently, which this function currently avoids
but which is an easy trap to fall into.

Since named return values are all or nothing we need to name the waitGroup too
and adjust the code to suite.

Thanks to Aaron Lehmann for the suggestion, see also
https://github.com/docker/swarmkit/pull/1965#discussion_r118137410

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-05-24 15:34:39 +01:00
Derek McGowan
40d338b12c
Skip snapshot removal on windows
Windows snapshotter is not yet implemented

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-23 17:18:31 -07:00
Derek McGowan
e1ed4a2ea4
Add json storage for container storage
This is just a temporary storage solution to get
containers running on the new code.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-23 14:22:20 -07:00
Stephen J Day
539742881d
api/services: define the container metadata service
Working from feedback on the existing implementation, we have now
introduced a central metadata object to represent the lifecycle and pin
the resources required to implement what people today know as
containers. This includes the runtime specification and the root
filesystem snapshots. We also allow arbitrary labeling of the container.
Such provisions will bring the containerd definition of container closer
to what is expected by users.

The objects that encompass today's ContainerService, centered around the
runtime, will be known as tasks. These tasks take on the existing
lifecycle behavior of containerd's containers, which means that they are
deleted when they exit. Largely, there are no other changes except for
naming.

The `Container` object will operate purely as a metadata object. No
runtime state will be held on `Container`. It only informs the execution
service on what is required for creating tasks and the resources in use
by that container. The resources referenced by that container will be
deleted when the container is deleted, if not in use. In this sense,
users can create, list, label and delete containers in a similar way as
they do with docker today, without the complexity of runtime locks that
plagues current implementations.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-05-22 23:27:53 -07:00
Michael Crosby
d7af92e00c Move Mount into mount pkg
This moves both the Mount type and mountinfo into a single mount
package.

This also opens up the root of the repo to hold the containerd client
implementation.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-22 16:41:12 -07:00
Derek McGowan
b07504c713 Merge pull request #862 from crosbymichael/checkpoint
Initial Support for Checkpoint && Restore
2017-05-22 15:51:10 -07:00
Michael Crosby
7cc1b64bd8 Add checkpoint and restore
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Update go-runc to 49b2a02ec1ed3e4ae52d30b54a291b75

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add shim to restore creation

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Keep checkpoint path in service

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add C/R to non-shim build

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Checkpoint rw and image

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Pause container on bind checkpoints

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Return dump.log in error on checkpoint failure

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Pause container for checkpoint

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Update runc to 639454475cb9c8b861cc599f8bcd5c8c790ae402

For checkpoint into to work you need runc version
639454475cb9c8b861cc599f8bcd5c8c790ae402 + and criu 3.0 as this is what
I have been testing with.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Move restore behind create calls

This remove the restore RPCs in favor of providing the checkpoint
information to the `Create` calls of a container.  If provided, the
container will be created/restored from the checkpoint instead of an
existing container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Regen protos after rebase

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-22 15:34:45 -07:00
Evan Hazlett
ef026e83fa add --mount option to ctr
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-22 16:48:34 -04:00
Evan Hazlett
70dd7fcc60 shim: Ps -> Processes
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-18 11:05:48 -04:00
Evan Hazlett
395d21018f PsRequest/PsResponse -> ProcessesRequest/ProcessesResponse; added Any to types.Process
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-18 11:05:48 -04:00
Evan Hazlett
ef158f8b5e add support to kill container process by pid
This adds support for signalling a container process by pid.

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

make Ps more extensible

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

ps: windows support

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-18 11:05:48 -04:00
Derek McGowan
4304da2b58
Delete rootfs when container is deleted
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-16 13:48:53 -07:00
Derek McGowan
3ae69c43d8
Add diff service implementation
Add snapshot subcommand to ctr for creating diffs of RW layers.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-16 13:48:53 -07:00
Derek McGowan
098ff94b24
Add snapshot and diff service
Remove rootfs service in place of snapshot service. Adds
diff service for extracting and creating diffs. Diff
creation is not yet implemented. This service allows
pulling or creating images without needing root access to
mount. Additionally in the future this will allow containerd
to ensure extractions happen safely in a chroot if needed.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-15 16:50:16 -07:00
Kenfe-Mickael Laventure
ac5563a809 ctr: honor rootfs argument value when generating spec
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-15 15:27:26 -07:00
Michael Crosby
ac98ef7439 Add --net-host for testing host networking
Add `--net-host` to `ctr run` to test containers running in host
networking.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-15 13:41:57 -07:00
Akihiro Suda
2562aca1a3 new service: version
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-11 09:07:43 +00:00
Stephen J Day
193abed96e
content: unify provider and ingester
The split between provider and ingester was a long standing division
reflecting the client-side use cases. For the most part, we were
differentiating these for the algorithms that operate them, but it made
instantation and use of the types challenging. On the server-side, this
distinction is generally less important. This change unifies these types
and in the process we get a few benefits.

The first is that we now completely access the content store over GRPC.
This was the initial intent and we have now satisfied this goal
completely. There are a few issues around listing content and getting
status, but we resolve these with simple streaming and regexp filters.
More can probably be done to polish this but the result is clean.

Several other content-oriented methods were polished in the process of
unification. We have now properly seperated out the `Abort` method to
cancel ongoing or stalled ingest processes. We have also replaced the
`Active` method with a single status method.

The transition went extremely smoothly. Once the clients were updated to
use the new methods, every thing worked as expected on the first
compile.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-05-10 17:05:53 -07:00
Michael Crosby
23b2b09d13 Update deps after move to containerd org
This updates containerd to use the latest versions of cgroups, fifo,
console, and go-runc from the containerd org.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-10 16:51:48 -07:00
Akihiro Suda
837205005f fix make vet failures, and enable make vet on CI
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-10 04:36:41 +00:00
Stephen Day
25a161bf5d Merge pull request #812 from AkihiroSuda/ctr-rootfs
Allow specification of rootfs in ctr
2017-05-08 11:47:07 -07:00
Daniel, Dao Quang Minh
392dfd656e Merge pull request #792 from coolljt0725/consistent_error
Use consistent errors package
2017-05-08 12:37:36 -05:00
Phil Estes
91410874e7
Add pause/unpause implementation
This adds pause and unpause to containerd's execution service and the
same commands to the `ctr` client.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2017-05-06 16:05:37 -04:00
Justin Cormack
4535198999 Allow specification of rootfs in ctr
carry: justincormack/containerd@ffe684b017

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-06 17:26:02 +00:00
Justin Cormack
1d27259777 Partial port to Darwin and FreeBSD
This mainly fixes Linux vs generic Unix differences, with some
differences between Darwin and Freebsd (which are close bit not
identical). Should make fixing for other Unix platforms easier.

Note there are not yet `runc` equivalents for these platforms;
my current use case is image manipulation for the `moby` tool.
However there is interest in OCI runtime ports for both platforms.

Current status is that MacOS can build and run `ctr`, `dist`
and `containerd` and some operations are supported. FreeBSD 11
still needs some more fixes to continuity for extended attributes.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-04 18:11:53 +01:00
Phil Estes
c3efbc37bc Merge pull request #798 from sak0/dev
ctr exec: container id must be provided
2017-05-04 12:21:18 -04:00
CuiHaozhi
c88d5b1dc9 ctr exec: container id must be provided
Signed-off-by: CuiHaozhi <cuihz@wise2c.com>
2017-05-04 10:40:33 -04:00
Krasi Georgiev
0a24b100e3 ctr couldn't exit when the grpc containerd server is not running
Signed-off-by: Krasi Georgiev <krasi.root@gmail.com>
2017-05-04 12:27:01 +03:00
Lei Jitang
75b889dd2e Use consistent errors package
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2017-05-02 08:26:06 -04:00
Yanqiang Miao
bcc4d12706 Add an alias for ctr list
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-04-25 11:49:56 +08:00
Stephen Day
ce72a829c7 Merge pull request #752 from stevvooe/ctr-list-quiet
cmd/ctr: add quiet mode to `ctr list`
2017-04-24 13:46:58 -05:00
Stephen J Day
0377bfda5d
cmd/ctr: add quiet mode to ctr list
This is so I can delete all the containers I keep creating.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-04-24 12:19:47 -05:00
Krasi Georgiev
e03485acda forward all signals to the container
Signed-off-by: Krasi Georgiev <krasi.root@gmail.com>
2017-04-22 01:46:57 +03:00
Michael Crosby
caa1de319e Merge pull request #713 from mlaventure/windows-runtime
Windows Pty and CloseStdin
2017-04-12 11:36:54 -07:00
Kenfe-Mickael Laventure
918a3ee4a1 Implement Pty and CloseStdin for windows runtime
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-04-11 07:30:59 -07:00
Kenfe-Mickael Laventure
22a051c88e Refactor windows runtime
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-04-11 07:30:59 -07:00
Justin Cormack
2d8c735aa6 Add back the runtime-config flag in ctr run
This flag was already implemented but could not be specified any more.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-11 11:56:41 +01:00
Michael Crosby
3db1ea8d07 [bin] Replace syscall with /x/sys/unix
Replace syscall usage with /sys/unix in the binaries and their packages

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-10 12:01:33 -07:00
Phil Estes
4f33aa2b5c Merge pull request #702 from crosbymichael/attach
Expose Pty resize and CloseStdin RPCs
2017-04-10 14:38:30 -04:00
Kenfe-Mickael Laventure
ab9c4c31d6 Fix dist socket parameter
It was renamed to address.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-04-10 09:37:43 -07:00
Michael Crosby
a7da08b7ba Add Pty and CloseStdin RPCs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-07 11:20:10 -07:00
Kenfe-Mickael Laventure
c5843b7615 Initial windows runtime work
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-04-07 09:20:44 -07:00
Michael Crosby
47225c130c Add ctr exec
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-06 10:36:47 -07:00
Yanqiang Miao
4aec91fd96 replace 'gocontext.Background' with the var 'ctx'
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-04-05 17:40:48 +08:00
Qiang Huang
e6f02dcb0b Add ctr kill command
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-04-05 09:04:59 +08:00
Stephen J Day
8c74da3983
cmd/dist, cmd/ctr: move image store access to GRPC
With this changeset, image store access is now moved to completely
accessible over GRPC. No clients manipulate the image store database
directly and the GRPC client is fully featured. The metadata database is
now managed by the daemon and access coordinated via services.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-04-04 10:35:55 -07:00
Michael Crosby
4f2b443a27 Rewrite imports for new github org
This rewrites the Go imports after switching to the new github org.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-03 14:05:44 -07:00
Phil Estes
efb16dad44 Merge pull request #661 from crosbymichael/stdin-closer
Open stdin write side in shim
2017-04-03 12:25:43 -04:00
Stephen Day
45cdc51a09 Merge pull request #673 from AkihiroSuda/run-revive-cmd
ctr/run: revive specifying custom command
2017-03-31 14:14:39 -07:00
Akihiro Suda
71870d7631 ctr/run: revive specifying custom command
e.g.

    $ ctr run --id foo docker.io/library/busybox:latest ls

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-03-31 02:21:33 +00:00
unclejack
e91d6805af archive,cmd,fs: return err directly
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2017-03-30 11:32:13 +03:00
Michael Crosby
b1fcb1745f Open stdin write side in shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-24 15:41:12 -07:00
Derek McGowan
379bd95a3c Merge pull request #660 from crosbymichael/image-config
ctr: generate spec based on image config
2017-03-24 13:08:42 -07:00
Michael Crosby
71e8d765df set +x on overlay fs dirs
We need to set +x on the overlay dirs or after dropping from root to a
non-root user an eperm will happen on exec or other file access

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-24 12:55:35 -07:00
Vincent Batts
bb2e665c68
ctr: spaces not tabs
the prior use of tabs left the top of point

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-03-24 13:23:56 -04:00
Michael Crosby
597815af7e Generate spec based on image config
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-23 15:40:09 -07:00
Michael Crosby
977939850b Update runtime spec to 035da1dca3dfbb00d752eb58b0b
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-22 11:44:25 -07:00
Derek McGowan
65e2c02ee1 Merge pull request #650 from stevvooe/move-image-to-images
images: move image package to images
2017-03-21 23:39:23 -07:00
Stephen J Day
39da6ff879
images: move image package to images
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-03-21 17:36:37 -07:00
Derek McGowan
26fe49a7bc Merge pull request #647 from otsneh/spec-values-fix
Update shim exec rpc to take fewer args
2017-03-21 17:03:04 -07:00
Ophir Sneh
87f94bf79b Update shim exec rpc to take fewer args
Signed-off-by: Ophir Sneh <otsneh@gmail.com>
2017-03-21 15:34:02 -07:00
Stephen J Day
e53539c58f
cmd/dist, cmd/ctr: end to end image pull
With this changeset, we now have a proof of concept of end to end pull.
Up to this point, the relationship between subsystems has been somewhat
theoretical. We now leverage fetching, the snapshot drivers, the rootfs
service, image metadata and the execution service, validating the proposed
model for containerd. There are a few caveats, including the need to move some
of the access into GRPC services, but the basic components are there.

The first command we will cover here is `dist pull`. This is the analog
of `docker pull` and `git pull`. It performs a full resource fetch for
an image and unpacks the root filesystem into the snapshot drivers. An
example follows:

``` console
$ sudo ./bin/dist pull docker.io/library/redis:latest
docker.io/library/redis:latest:                                                   resolved       |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:4c8fb09e8d634ab823b1c125e64f0e1ceaf216025aa38283ea1b42997f1e8059: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:3b281f2bcae3b25c701d53a219924fffe79bdb74385340b73a539ed4020999c4:    done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:e4a35914679d05d25e2fccfd310fde1aa59ffbbf1b0b9d36f7b03db5ca0311b0:   done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:4b7726832aec75f0a742266c7190c4d2217492722dfd603406208eaa902648d8:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:338a7133395941c85087522582af182d2f6477dbf54ba769cb24ec4fd91d728f:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:83f12ff60ff1132d1e59845e26c41968406b4176c1a85a50506c954696b21570:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:693502eb7dfbc6b94964ae66ebc72d3e32facd981c72995b09794f1e87bac184:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:622732cddc347afc9360b4b04b46c6f758191a1dc73d007f95548658847ee67e:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:19a7e34366a6f558336c364693df538c38307484b729a36fede76432789f084f:    done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 1.6 s                                                                    total:   0.0 B (0.0 B/s)
INFO[0001] unpacking rootfs
```

Note that we haven't integrated rootfs unpacking into the status output, but we
pretty much have what is in docker today (:P). We can see the result of our pull
with the following:

```console
$ sudo ./bin/dist images
REF                            TYPE                                                 DIGEST                                                                  SIZE
docker.io/library/redis:latest application/vnd.docker.distribution.manifest.v2+json sha256:4c8fb09e8d634ab823b1c125e64f0e1ceaf216025aa38283ea1b42997f1e8059 1.8 kB
```

The above shows that we have an image called "docker.io/library/redis:latest"
mapped to the given digest marked with a specific format. We get the size of
the manifest right now, not the full image, but we can add more as we need it.
For the most part, this is all that is needed, but a few tweaks to the model
for naming may need to be added. Specifically, we may want to index under a few
different names, including those qualified by hash or matched by tag versions.
We can do more work in this area as we develop the metadata store.

The name shown above can then be used to run the actual container image. We can
do this with the following command:

```console
$ sudo ./bin/ctr run --id foo docker.io/library/redis:latest /usr/local/bin/redis-server
1:C 17 Mar 17:20:25.316 # Warning: no config file specified, using the default config. In order to specify a config file use /usr/local/bin/redis-server /path/to/redis.conf
1:M 17 Mar 17:20:25.317 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.2.8 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

1:M 17 Mar 17:20:25.326 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 17 Mar 17:20:25.326 # Server started, Redis version 3.2.8
1:M 17 Mar 17:20:25.326 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 17 Mar 17:20:25.326 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 17 Mar 17:20:25.326 * The server is now ready to accept connections on port 6379
```

Wow! So, now we are running `redis`!

There are still a few things to work out. Notice that we have to specify the
command as part of the arguments to `ctr run`. This is because are not yet
reading the image config and converting it to an OCI runtime config. With the
base laid in this PR, adding such functionality should be straightforward.

While this is a _little_ messy, this is great progress. It should be easy
sailing from here.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-03-21 13:08:23 -07:00
Michael Crosby
6d3a70eb58 Make ctr --rootfs an absolute path
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-09 16:13:23 -08:00
Volodymyr Burenin
72034dad40 Do not read all IO if container is not started.
Signed-off-by: Volodymyr Burenin <vburenin@gmail.com>
2017-03-06 13:47:45 -06:00
Volodymyr Burenin
2972f2728f Added new flag for 'ctr run' to specify user defined runtime.
Signed-off-by: Volodymyr Burenin <vburenin@gmail.com>
2017-03-06 13:11:31 -06:00
Phil Estes
994aebc698 Merge pull request #565 from ijc25/execution-service-get-container-info
Add ContainerService.Info to get info about a single container
2017-02-24 13:37:18 -08:00
Ian Campbell
cc253b0f18 Add ContainerService.Info to get info about a single container
For clients which only want to know about one container this is simpler than
searching the result of execution.List.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-02-24 17:50:46 +00:00
kevinetc123
fa584958fc using github.com/pkg/errors & correct some typo mistakes
Signed-off-by: kevinetc123 <kaiwentan@harmonycloud.cn>
2017-02-24 10:59:11 +08:00
Daniel, Dao Quang Minh
660783cb00 Merge pull request #548 from fate-grand-order/fixed
Use errors.New() directly to output the error message
2017-02-23 11:06:04 +00:00
Stephen J Day
935144fadd
version: finish version setup
This setup will now correctly set the version number from the git tag.
When using `--version`, we will see the binary name, the package it was
built from and a git hash based on the tag:

```console
$./bin/dist -v
./bin/dist github.com/docker/containerd 0b45d91.m
```

Note that in the above example, if we set a tag of `v1.0.0-dev`, that
will show up in the version number, as follows:

```console
$./bin/dist -v
./bin/dist github.com/docker/containerd v1.0.0-dev
```

Once commits are made past that tag, the version number will be
expressed relative to that tag and include a git hash:

```console
$./bin/dist -v
./bin/dist github.com/docker/containerd v1.0.0-dev-1-g7953e96.m
```

Some these examples include a `.m` postfix. This indicates that the
binary was build from a source tree with local modifications.

We can add a dev tag to start getting 1.0 version numbers for test
builds.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-02-22 13:16:06 -08:00
fate-grand-order
08405824ad Use errors.New() directly to output the error message
Signed-off-by: fate-grand-order <chenjg@harmonycloud.cn>
2017-02-22 10:53:16 +08:00
Michael Crosby
f01434283c Merge pull request #553 from crosbymichael/config
Add config file
2017-02-21 11:52:08 -08:00
Michael Crosby
a9950aedcf Add config file
This adds a config file for containerd configuration.  It is hard to
have structure data on cli flags and the config file should be used for
the majority of fields when configuring containerd.

There are still a few flags on the daemon that override config file
values but flags should take a back seat going forward and should be
kept at a minimum.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-21 11:22:08 -08:00
Qiang Huang
f83652dbf1 Ensure to read all io in error cases
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-02-21 08:46:04 -08:00
Akihiro Suda
5f6f04742c ctr: add --runtime-config
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-02-21 05:04:18 +00:00
Akihiro Suda
2836fbeed1 ctr: fix Sprintf
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-02-20 05:28:09 +00:00
Michael Crosby
47ececd6b8 Change Container interface to include Info
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-16 09:59:40 -08:00
Michael Crosby
ab8586b7c5 Remove bundles from API
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-15 13:56:41 -08:00
Akihiro Suda
bf8abef70f api: introduce api/{types,services} for deduplication of API definition
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-02-14 02:42:13 +00:00
Michael Crosby
89f62d4fae Merge pull request #515 from fate-grand-order/branch
Use errors.New() directly to output the error message
2017-02-10 13:55:10 -08:00
fate-grand-order
af86cd4d2f Use error.New () directly to output the error message
Signed-off-by: fate-grand-order <chenjg@harmonycloud.cn>
2017-02-10 14:31:49 +08:00
Kunal Kushwaha
a9ea9d80a3 ctr pprof support added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2017-02-10 11:16:40 +09:00
Kenfe-Mickael Laventure
b4a299e61d supervisor/shim: add exec support
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-02-07 09:25:55 -08:00
Kenfe-Mickael Laventure
78d7e8b256 supervisor: implement monitoring
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-02-06 15:16:55 -08:00
Kenfe-Mickael Laventure
31f26fed18 Move to a single Event type
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-02-06 08:46:37 -08:00
Kenfe-Mickael Laventure
6f9eda1134 api/execution: remove ProcessID from rpc calls
Now that the shim handles all container's processes the system pid is
sufficient.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-02-02 15:36:10 -08:00
Kenfe-Mickael Laventure
40b0b211b7 api/execution: add Container suffix to relevant rpc calls
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-02-02 14:40:23 -08:00
Michael Crosby
f187da9485 Port over supervisor to use grpc shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-01 16:01:53 -08:00
Kenfe-Mickaël Laventure
24c2810899 Merge pull request #462 from crosbymichael/shim
shim: GRPC service
2017-01-26 16:11:45 -08:00
Michael Crosby
f70d485d72 Merge pull request #468 from jzwlqx/master
optimal help info for ctr cli.
2017-01-26 15:34:31 -08:00
Michael Crosby
f431bf4ad4 Add state rpc to shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-01-26 15:09:59 -08:00
Michael Crosby
b59bd59d8a Working tty and io support in shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-01-26 11:31:17 -08:00
Michael Crosby
07c81ccac4 Add events api to shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-01-26 11:31:17 -08:00
Michael Crosby
e09b0b0c35 Add exec functionality to shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-01-26 11:31:17 -08:00
Michael Crosby
bf036b9d78 Add ctr shim command
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-01-26 11:31:17 -08:00
Kenfe-Mickaël Laventure
b5ee0b1bd4 Merge pull request #451 from AkihiroSuda/trivial-cleanup
*: clean up
2017-01-25 11:02:38 -08:00