Commit graph

835 commits

Author SHA1 Message Date
Stephen J Day
f9cd9be61a
dist: expand functionality of the dist tool
With this change, we add the following commands to the dist tool:

- `ingest`: verify and accept content into storage
- `active`: display active ingest processes
- `list`: list content in storage
- `path`: provide a path to a blob by digest
- `delete`: remove a piece of content from storage

We demonstrate the utility with the following shell pipeline:

```
$ ./dist fetch docker.io/library/redis latest mediatype:application/vnd.docker.distribution.manifest.v2+json | \
    jq -r '.layers[] | "./dist fetch docker.io/library/redis "+.digest + "| ./dist ingest --expected-digest "+.digest+" --expected-size "+(.size | tostring) +" docker.io/library/redis@"+.digest' | xargs -I{} -P10 -n1 sh -c "{}"
```

The above fetches a manifest, pipes it to jq, which assembles a shell
pipeline to ingest each layer into the content store. Because the
transactions are keyed by their digest, concurrent downloads and
downloads of repeated content are ignored. Each process is then executed
parallel using xargs.

Put shortly, this is a parallel layer download.

In a separate shell session, could monitor the active downloads with the
following:

```
$ watch -n0.2 ./dist active
```

For now, the content is downloaded into `.content` in the current
working directory. To watch the contents of this directory, you can use
the following:

```
$ watch -n0.2 tree .content
```

This will help to understand what is going on internally.

To get access to the layers, you can use the path command:

```
$./dist path sha256:010c454d55e53059beaba4044116ea4636f8dd8181e975d893931c7e7204fffa
sha256:010c454d55e53059beaba4044116ea4636f8dd8181e975d893931c7e7204fffa /home/sjd/go/src/github.com/docker/containerd/.content/blobs/sha256/010c454d55e53059beaba4044116ea4636f8dd8181e975d893931c7e7204fffa
```

When you are done, you can clear out the content with the classic xargs
pipeline:

```
$ ./dist list -q | xargs ./dist delete
```

Note that this is mostly a POC. Things like failed downloads and
abandoned download cleanup aren't quite handled. We'll probably make
adjustments around how content store transactions are handled to address
this.

From here, we'll build out full image pull and create tooling to get
runtime bundles from the fetched content.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-01-27 10:29:10 -08:00
Phil Estes
3c44ec5dbc Merge pull request #470 from samuelkarp/root-test
snapshot: Separate tests using root from non-root
2017-01-25 18:14:51 -08:00
Samuel Karp
cacda40317 snapshot: Separate tests using root from non-root
Signed-off-by: Samuel Karp <skarp@amazon.com>
2017-01-25 17:13:29 -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
Kenfe-Mickaël Laventure
682a37f25c Merge pull request #453 from AkihiroSuda/fix-state-dir
shim executor: fix an issue about empty stateDir
2017-01-24 11:06:16 -08:00
Stephen Day
69d0323fa3 Merge pull request #464 from kunalkushwaha/dist-makefile
Adding dist to Makefile
2017-01-24 10:36:36 -08:00
Michael Crosby
0f0fb59cd1 Merge pull request #463 from stevvooe/cleanup-content-store
content: cleanup package exports
2017-01-24 09:52:16 -08:00
Kunal Kushwaha
2a5f51ecf9 Adding dist to Makefiley
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2017-01-24 13:26:19 +09:00
Stephen J Day
f27d43285a
content: cleanup package exports
The package exports are now cleaned up to remove a lot of stuttering in
the API. We also remove direct mapping of refs to the filesystem, opting
for a hash-based approach. This *does* affect insertion performance,
since it requires more individual file ios. A benchmark baseline has
been added and we can fix this later.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-01-23 20:11:35 -08:00
Akihiro Suda
36bd3cae27 shim executor: fix an issue about empty stateDir
A new process could not be created because of an error caused by an empty
stateDir string

  $ ctr exec ...
  rpc error: code = 2 desc = failed to create process state dir: mkdir : no such file or directory

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-24 04:06:55 +00:00
Stephen Day
3b79682548 Merge pull request #455 from Mashimiao/bundle-add-check-before-Load
bundle: add check before Load return
2017-01-23 15:48:56 -08:00
Michael Crosby
edcf44ea57 Merge pull request #452 from stevvooe/dist-tool-poc
cmd/dist: POC implementation of dist fetch
2017-01-23 15:18:04 -08:00
Stephen J Day
19eecaab12
cmd/dist: POC implementation of dist fetch
With this changeset we introduce several new things. The first is the
top-level dist command. This is a toolkit that implements various
distribution primitives, such as fetching, unpacking and ingesting.

The first component to this is a simple `fetch` command. It is a
low-level command that takes a "remote", identified by a `locator`, and
an object identifier. Keyed by the locator, this tool can identify a
remote implementation to fetch the content and write it back to standard
out. By allowing this to be the unit of pluggability in fetching
content, we can have quite a bit of flexibility in how we retrieve
images.

The current `fetch` implementation provides anonymous access to docker
hub images, through the namespace `docker.io`. As an example, one can
fetch the manifest for `redis` with the following command:

```
$ ./dist fetch docker.io/library/redis latest mediatype:application/vnd.docker.distribution.manifest.v2+json
```

Note that we have provided a mediatype "hint", nudging the fetch
implementation to grab the correct endpoint. We can hash the output of
that to fetch the same content by digest:

```
$ ./dist fetch docker.io/library/redis sha256:$(./dist fetch docker.io/library/redis latest mediatype:application/vnd.docker.distribution.manifest.v2+json | shasum -a256)
```

Note that the hint is now elided, since we have affixed the content to a
particular hash.

If you are not yet entertained, let's bring `jq` and `xargs` into the
mix for maximum fun. The following incantation fetches the same manifest
and downloads all layers into the convenience of `/dev/null`:

```
$ ./dist fetch docker.io/library/redis sha256:a027a470aa2b9b41cc2539847a97b8a14794ebd0a4c7c5d64e390df6bde56c73 | jq -r '.layers[] | .digest' | xargs -n1 -P10 ./dist fetch docker.io/library/redis > /dev/null
```

This is just the beginning. We should be able to centralize
configuration around fetch to implement a number of distribution
methodologies that have been challenging or impossible up to this point.
The `locator`, mentioned earlier, is a schemaless URL that provides a
host and path that can be used to resolve the remote. By dispatching on
this common identifier, we should be able to support almost any protocol
and discovery mechanism imaginable.

When this is more solidified, we can roll these up into higher-level
operations that can be orchestrated through the `dist` tool or via GRPC.

What a time to be alive!

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-01-23 13:27:07 -08:00
Kenfe-Mickaël Laventure
4180eebf27 Merge pull request #448 from AkihiroSuda/cleanup
rootfs: fix compilation error (includes sirupsen->Sirupsen fix)
2017-01-23 12:00:51 -08:00
Akihiro Suda
7fed38881d rootfs: fix compilation error
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-23 08:54:57 +00:00
Akihiro Suda
727f0a536e vendor: sirupsen/logrus -> Sirupsen/logrus
github.com/docker/docker/pkg/archive requires Sirupsen/logrus.
So let's remove sirupsen/logrus at the moment.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-23 08:50:08 +00:00
Ma Shimiao
ffc4c570af bundle: add check before Load return
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-01-23 09:09:03 +08:00
Michael Crosby
523bb8d992 Merge pull request #456 from crosbymichael/report-jan-20
Add Development Report for Jan 20
2017-01-20 15:48:20 -08:00
Kenfe-Mickaël Laventure
8228996a4a Merge pull request #457 from crosbymichael/update-go-runc
Update go-runc to afca56d262e694d9056e937a0877a39ab879aeb4
2017-01-20 13:52:39 -08:00
Michael Crosby
b895c98358 Update go-runc to afca56d262e694d9056e937a0877a39ab879aeb4
This includes fixes for --console-socket in runc as well as additional
APIs for runc commands.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-01-20 13:42:14 -08:00
Michael Crosby
64d398d1cc Add report for jan 20
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-01-20 13:13:06 -08:00
Stephen Day
7101c7a9e2 Merge pull request #434 from AkihiroSuda/terminology
snapshot: fix terminology inconsistency
2017-01-19 19:33:34 -08:00
Akihiro Suda
1f763301a6 snapshot: fix terminology inconsistency
LayerManipulator, SnapshotManipulator -> SnapshotManager

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-20 02:02:29 +00:00
Akihiro Suda
e9bfed4cf2 *: clean up
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-20 01:50:08 +00:00
Michael Crosby
7c975e37a9 Merge pull request #450 from crosbymichael/makefile
Fix makefile install
2017-01-19 11:17:55 -08:00
Michael Crosby
61e7fbde4c Remove check for binaries
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-01-19 11:09:27 -08:00
Akihiro Suda
5fb38ce49c Makefile: allow make install without go
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-19 11:05:52 -08:00
Michael Crosby
2869aac1e5 Merge pull request #445 from AkihiroSuda/revert-432-makefile-non-force
Revert "Makefile: remove FORCE dependency"
2017-01-19 11:00:26 -08:00
Michael Crosby
c26e2bde5a Merge pull request #447 from fate-grand-order/master
Correct spelling errors in annotations in locks.go
2017-01-19 10:59:03 -08:00
Michael Crosby
983d817470 Merge pull request #449 from xulike666/fight-for-readability
Fix all typos I found in this repo.
2017-01-19 10:58:20 -08:00
Michael Crosby
0d11d1c26f Merge pull request #446 from mlaventure/no-state-dir
Remove StateDir type
2017-01-19 10:56:57 -08:00
Aaron.L.Xu
08bcbddb32 fix typo I found in this repo
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-01-20 01:18:26 +08:00
Kenfe-Mickael Laventure
bd6057c8e1 execution: remove statedir type
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-01-19 08:31:11 -08:00
Kenfe-Mickael Laventure
3f2d9d19bf execution: remove oci executor
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-01-19 07:57:02 -08:00
Phil Estes
0a58d55e63 Merge pull request #443 from AkihiroSuda/fix-defer
shim executor: clean state dir if newProcess() failed
2017-01-19 10:54:31 -05:00
fate-grand-order
3400a450f2 Correct spelling errors in annotations in locks.go
Signed-off-by: fate-grand-order <chenjg@harmonycloud.cn>
2017-01-19 12:27:51 +08:00
Akihiro Suda
d92f60e367 shim executor: clean state dir if newProcess() failed
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-19 02:36:35 +00:00
Akihiro Suda
bcfb5e7cee Revert "Makefile: remove FORCE dependency"
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-19 01:28:43 +00:00
Michael Crosby
7465a6de1b Merge pull request #427 from docker/rootfs-poc
rootfs: pseudo-implementation of rootfs unpacking
2017-01-18 11:51:24 -08:00
Stephen Day
3cd4f25c11 Merge pull request #438 from crosbymichael/remove-mnt-cmd
Remove shelling out to mount
2017-01-18 11:43:35 -08:00
Michael Crosby
a7a6270f2a Remove shelling out to mount
Also remove the target from the Mount struct because it should not be
used at all.  The target can be variable and set by a caller, not by the
snapshot drivers.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-01-18 11:10:31 -08:00
Michael Crosby
e3595680a9 Merge pull request #423 from AkihiroSuda/list
ctr: add commands: `list` and `inspect`
2017-01-18 10:03:51 -08:00
Michael Crosby
7d0b1eef8e Merge pull request #440 from coolljt0725/readme_typo
typo: fix typo in README.md
2017-01-18 09:37:33 -08:00
Lei Jitang
1640c297d3 typo: fix typo in README.md
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2017-01-17 23:01:23 -05:00
Akihiro Suda
8bd1b0d2e4 ctr: add commands: list and inspect
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-18 02:47:42 +00:00
Stephen J Day
8b5c7ce901
vendor: include github.com/opencontainers/image-spec
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-01-17 17:08:37 -08:00
Stephen J Day
460314d667
rootfs: pseudo-implementation of rootfs unpacking
This defines a new package for assembling rootfs with layers and
snapshots. We define some base types and operations that represent the
boiled down process of the unpacking a rootfs.

This code is untested but provides a base to work towards a full
implementation of rootfs unpacking.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-01-17 17:05:28 -08:00
Kenfe-Mickaël Laventure
abc1bf4dea Merge pull request #429 from datawolf/io-set-termios-onlcr-for-master
Set -ONLCR on created consoles
2017-01-17 14:07:50 -08:00
Michael Crosby
c0fdda03cc Merge pull request #432 from AkihiroSuda/makefile-non-force
Makefile: remove FORCE dependency
2017-01-17 10:58:54 -08:00
Michael Crosby
7d39f2d0e6 Merge pull request #430 from hqhq/fix_check_error
Fix go vet errors
2017-01-17 10:51:35 -08:00