Commit Graph

1236 Commits

Author SHA1 Message Date
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
Phil Estes fa71fc91fa Merge pull request #631 from chanezon/master
added website code for containerd.io
2017-03-21 09:14:26 -07:00
Akihiro Suda 6bd0710831 plugin: disable Go 1.8 plugin on non-amd64
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-03-21 08:34:05 +00:00
Derek McGowan f251d2b487 Merge pull request #643 from stevvooe/clarify-digest-description
reference: clarify digest description
2017-03-20 17:09:36 -07:00
Stephen J Day d325c8b1d5
reference: clarify digest description
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-03-20 17:01:06 -07:00
Qiang Huang 5f6edd072c Merge pull request #639 from crosbymichael/report-317
Add dev report for mar 17 2017
2017-03-18 05:49:25 -05:00
Stephen Day a98b81c572
reports: add update on image pull
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-03-17 18:00:38 -07:00
Michael Crosby 2e2c61ba27 Add dev report for mar 17 2017
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-17 16:35:53 -07:00
Michael Crosby ffbe36e118 Merge pull request #638 from stevvooe/refactor-fetch
cmd/dist, image, remotes: introduce image handlers
2017-03-17 16:07:25 -07:00
Stephen J Day 5a3151eefc
cmd/dist, image, remotes: introduce image handlers
With this PR, we introduce the concept of image handlers. They support
walking a tree of image resource descriptors for doing various tasks
related to processing them. Handlers can be dispatched sequentially or
in parallel and can be stacked for various effects.

The main functionality we introduce here is parameterized fetch without
coupling format resolution to the process itself. Two important
handlers, `remotes.FetchHandler` and `image.ChildrenHandler` can be
composed to implement recursive fetch with full status reporting. The
approach can also be modified to filter based on platform or other
constraints, unlocking a lot of possibilities.

This also includes some light refactoring in the fetch command, in
preparation for submission of end to end pull.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-03-17 15:47:50 -07:00
Patrick Chanezon 06d5068055 removed unused images
Signed-off-by: Patrick Chanezon <patlist@chanezon.com>
2017-03-17 12:09:03 -07:00
Derek McGowan f95ba7c5ea Merge pull request #637 from fate-grand-order/typo
fix misspell "resources" in content/store.go
2017-03-16 23:42:13 -07:00
fate-grand-order 680e191c91 fix misspell "resources" in content/store.go
Signed-off-by: fate-grand-order <chenjg@harmonycloud.cn>
2017-03-17 10:41:24 +08:00
Michael Crosby e8622f970d Merge pull request #636 from stevvooe/rootfs-alreadyexists
services/rootfs: return grpc code on existence
2017-03-16 15:02:10 -07:00
Stephen J Day 0b65031e90
services/rootfs: return grpc code on existence
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-03-16 14:16:29 -07:00
Stephen Day bb3fbded9c Merge pull request #632 from dmcgowan/rootfs-fixes
Fix rootfs digest computation
2017-03-16 12:04:49 -07:00
Derek McGowan 0481a984b1 Merge pull request #542 from AkihiroSuda/compress
new package: compression (ported from docker/pkg/archive)
2017-03-15 22:46:59 -07:00
Akihiro Suda 6089c1525b new package: compression (ported from docker/pkg/archive)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-03-16 05:29:27 +00:00
Derek McGowan 4492a2cee3
Fix rootfs digest computation
Compute digest from uncompressed archive.
Properly propagate error on unpack.
Rename dist cmd commands to match command name.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 17:17:25 -07:00
Stephen Day 82a2d766ec Merge pull request #614 from dmcgowan/rootfs-service
Rootfs service
2017-03-15 16:44:03 -07:00
Derek McGowan 212efa578a
Remove get function from rootfs
The service can use the snapshotter directly to get the rootfs.
Removed debug line for mount response.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Derek McGowan b1bc82726f
Rename prepare to unpack and init to prepare
Unpack and prepare better map to the actions done by rootfs.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Derek McGowan 340e56ecd0
Update comments in rootfs and for desciptor
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Derek McGowan 3a20dd41d5
Add init subcommand to rootfs
Init command gets the mounts for a given chain id and
outputs a mount command.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Derek McGowan 5d4577534a
Add init and get mounts to rootfs service
Update rootfs package to add mount initializer function.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Derek McGowan 38a6f90f2b
Add rootfs command to dist
Commands allows preparing a rootfs from a manifest hash

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Derek McGowan ead425f426
Add rootfs service
Add rootfs service to allow creation of rootfs from layer array

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Stephen Day 5c69a7fd6d Merge pull request #624 from crosbymichael/grpc-metrics
Add grpc prometheus metrics
2017-03-15 16:30:56 -07:00
Patrick Chanezon ecc0cc14c6 added website code for containerd.io
Signed-off-by: Patrick Chanezon <patlist@chanezon.com>
2017-03-15 13:14:10 -07:00
Phil Estes 92c7ed08b4 Merge pull request #628 from chchliang/containerdanalyz
Closed stream in store.go Active()
2017-03-15 10:45:27 -04:00
chchliang 4465e493fc Closed stream in store.go Active()
Signed-off-by: chchliang <chen.chuanliang@zte.com.cn>
2017-03-15 16:53:30 +08:00
Michael Crosby f9212348e4 Add grpc prometheus metrics
This provideds generic grpc metrics via prometheus

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-14 16:16:49 -07:00
Michael Crosby a85c28d248 Merge pull request #623 from hqhq/add_healthcheck_service
Add grpc health check service
2017-03-14 11:28:56 -07:00
Qiang Huang e663cbddf5 Add grpc health check service
Fixes: #615

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-03-14 15:39:29 +08:00
Phil Estes a132a884fa Merge pull request #601 from kunalkushwaha/testsuite-CommitView
Testcase for multiple Prepare/View on same key.
2017-03-13 16:05:55 -04:00
Derek McGowan a7734b060d Merge pull request #620 from crosbymichael/report-mar10
Add development report for Mar 10
2017-03-13 11:18:39 -07:00
Michael Crosby 51bf1896a0 Add report for Mar 10
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-13 11:05:06 -07:00
Michael Crosby 1d7fa45403 Add `no_shim` config for not running with a shim
This reuses the exiting shim code and services to let containerd run as
the reaper for all container processes without the use of a shim.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-10 15:28:21 -08:00
Kenfe-Mickaël Laventure a160a6a068 Merge pull request #618 from crosbymichael/summit2
Add link to signup form
2017-03-10 11:43:31 -08:00
Michael Crosby 1f15b058d2 Add link to signup form
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-10 11:40:27 -08:00
Phil Estes 7b06baa1f2 Merge pull request #616 from crosbymichael/runtime-opts
Runtime configs and global reaper
2017-03-10 14:25:19 -05:00
Kenfe-Mickaël Laventure 85f11a0bf2 Merge pull request #617 from crosbymichael/summit
Add dockercon summit discussion points
2017-03-10 11:07:00 -08:00
Michael Crosby ee2d005984 Add dockercon summit discussion points
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-10 10:51:53 -08:00
Michael Crosby fe53956044 Add missing monitor file
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-10 09:30:03 -08:00
Michael Crosby 61263bd77e Set containerd as subreaper
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-09 16:26:14 -08: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
Michael Crosby 9f3240364f Implement reaper with runc support in shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-09 16:11:57 -08:00
Michael Crosby df48983fe7 Add reaper code for daemon
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-09 16:07:35 -08:00
Michael Crosby 4fd2478513 Update go-runc to bd9aef7cf4402a3a8728e3ef83dcca6a5a1be899
Also remove the comment fields in the vndr script, they are too hard to
keep up to date and add little value when we have the git commit
timestamps

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-09 13:47:49 -08:00
Michael Crosby 0e0ae74b82 Merge pull request #612 from stevvooe/simplify-resolution-flow
cmd/dist, remotes: simplify resolution flow
2017-03-09 12:41:12 -08:00