Commit Graph

96 Commits

Author SHA1 Message Date
Jian Zeng
f706576500
feat: tag image using Transfer api
Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
2023-03-05 23:22:17 +08:00
Derek McGowan
13bf5565eb
[transfer] update export to use image store references
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-03-02 11:14:32 -08:00
Jian Zeng
f6491b0049
feat: export images using Transfer api
Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
2023-03-02 09:04:25 -08:00
Tony Fang
8a47c6910f Add a leading space after the comment sign
Fix coding standards

Signed-off-by: Tony Fang <nhfang@amazon.com>
2023-02-26 17:49:15 +00:00
Tony Fang
47305392c6 Add configuration options to local transfer service
Signed-off-by: Tony Fang <nhfang@amazon.com>
2023-02-25 03:40:06 +00:00
Wei Fu
e855a59984 cmd/ctr/commands/images: support usage subcommand
The `ctr image usage` can display the usage of snapshots with a given
image ref. It's easy for user to get chain snapshot IDs and unpack
usage. And according to the [discuss][1], this subcommand can be used to
ensure if snapshot's pagecache has been discarded in a unexpected
reboot.

How to use it:

```bash
$ bin/ctr image usage --snapshotter native docker.io/library/golang:1.19.3
ctr: image docker.io/library/golang:1.19.3 isn't unpacked in snapshotter native

$ bin/ctr image usage --snapshotter overlayfs docker.io/library/golang:1.19.3
KEY                                                                     SIZE      INODES
sha256:28114d8403bac6352c3e09cb23e37208138a0cd9d309edf3df38e57be8075a1d 16.0 KiB  4
sha256:f162c02ce6b9b594757cd76eda1c1dd119b88e69e882cb645bf7ad528b54f0d2 476.2 MiB 13660
sha256:a5b9faceaa495819b9ba7011b7276c4ffaffe6c7b9de0889e11abc1113f7b5ca 225.5 MiB 3683
sha256:412b2615d27d6b0090558d25b201b60a7dff2a40892a7e7ca868b80bf5e5de41 159.8 MiB 6196
sha256:dbce1593502d39c344ce089f98187999f294de5182a7106dcb6c9d04ce0c7265 19.4 MiB  502
sha256:8953bf5d24149e9b2236abc76bd0aa14b73828f1b63e816cb4b457249f6125bc 12.2 MiB  958
sha256:ccba29d6937047c719a6c048a7038d3907590fbb8556418d119469b2ad4f95bc 134.7 MiB 7245

$ bin/ctr image usage --snapshotter overlayfs docker.io/library/golang:1.19
ctr: failed to ensure if image docker.io/library/golang:1.19 exists: image "docker.io/library/golang:1.19": not found
```

[1]: <https://github.com/containerd/containerd/issues/5854#issuecomment-1415915765>

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-02-14 23:24:10 +08:00
Akihiro Suda
4e2eb8ba4e
Merge pull request #7964 from dmcgowan/transfer-image-store-references
[transfer] update imagestore interface to support multiple references
2023-02-14 11:22:27 +09:00
Derek McGowan
081601f521
Update imagestore interface to support multiple references
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-02-13 13:58:33 -08:00
yulng
757b8f702b
keep the uppercase letter for flag info
Signed-off-by: yulng <wei.yang@daocloud.io>
2023-02-06 16:37:24 +08:00
Derek McGowan
42eedc0bc7
Update ctr to make local the default for distribution
Disable using transfer service by default for now

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:57 -08:00
Derek McGowan
ef61e13a6e
Update import cli to use transfer service
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:56 -08:00
Derek McGowan
b991c71e90
Update pull command to use filter arguments
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:56 -08:00
Derek McGowan
0aca4bb1f2
Update ctr commands to use transfer interface
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:54 -08:00
Derek McGowan
e506cd103f
Implement client interface for transfer service
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:53 -08:00
Jin Dong
8e0a3c51a5 Add ctr image prune
Signed-off-by: Jin Dong <jindon@amazon.com>
2022-11-29 18:11:34 +00:00
Fu Wei
24020812bb
Merge pull request #7669 from yanggangtony/status-clean
make status more readable and update easy.
2022-11-27 23:12:23 +08:00
yanggang
e38e2c8a4d
make status more readable and update easy.
Signed-off-by: yanggang <gang.yang@daocloud.io>
2022-11-15 15:48:01 +08:00
yanggang
3abcfb5c07
keep the lower case letter for flag info
Signed-off-by: yanggang <gang.yang@daocloud.io>
2022-11-15 14:09:55 +08:00
Yasin Turan
78ac0046a7 ctr export strictly match default platform
Signed-off-by: Yasin Turan <turyasin@amazon.com>
2022-11-01 17:35:30 +00:00
James Jenkins
9d18b57469 Modify WithDiscardUnpackedLayers
Modify the WithDiscardUnpackedLayers function such that it does not
require any parameters.

Signed-off-by: James Jenkins <James.Jenkins@ibm.com>
2022-09-29 10:24:45 -04:00
James Jenkins
2432b54a56 Add new ctr option for discarding unpacked layers
Add a new ctr cli option, allowing the garbage collector to discard any
unpacked layers after importing an image. This new option is
incompatible with the no-unpack ctr import option.

Signed-off-by: James Jenkins <James.Jenkins@ibm.com>
2022-09-23 15:30:33 -04:00
xin.li
b2a7183a83 matching the casing of other flags for ctr's pull command.
Signed-off-by: xin.li <xin.li@daocloud.io>
2022-09-08 22:07:35 +08:00
Samuel Karp
542e4b219d
Merge pull request #6906 from ginglis13/6441-ctr-import 2022-08-23 17:35:40 -07:00
guiyong.ou
628f6ac681 code cleanup
Signed-off-by: guiyong.ou <guiyong.ou@daocloud.io>
2022-07-19 22:46:32 +08:00
Gavin Inglis
2c98a7b099 ctr import: strictly match platform
Currently, ctr import will use loose matching as defined by
platforms.Only(), meaning in the case of platform linux/amd64 as in
issue#6441, importing will also match linux/386 platform on the
image-to-be-imported's index. However, that image-to-be-imported may not
have both the linux/amd64 and linux/386 platform contents, resulting in
a failure to unpack the image. This change makes that check strict such
that the requested platform to import for is the only platform content
imported. Both ctr pull and ctr export will treat the platform option as
strict, so this change makes ctr import consistent with those.

resolves #6441

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
2022-05-06 22:44:43 +00:00
cosmoer
df93940fb2 fix: ctr images mount with snapshotter option can't get snapshotter
Signed-off-by: Qian Zhang <cosmoer@qq.com>
2022-03-23 23:12:54 +08:00
Derek McGowan
62f6c8175a
Merge pull request #6424 from cpuguy83/nondist-blob-push
Add support for skipping non-dist blob push
2022-01-19 19:12:31 -08:00
ning.a.li
a303d552ad ctr: Unify the delete subcommand alias
This commit unifies the following sub commands alias for
deleting/removing.
- containers
- tasks
- contents
- leases
- images
- snapshots

Signed-off-by: Ning Li <lining2020x@163.com>
2022-01-11 16:21:26 +08:00
Brian Goff
d05194f0a7 ctr: flag to toggle non-distributable blob push
With this flag, ctr will no longer automatically push non-distributable
artifacts by default.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2022-01-11 00:49:40 +00:00
haoyun
bbe46b8c43 feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: zounengren <zouyee1989@gmail.com>
2022-01-07 10:27:03 +08:00
jonyhy
933ddaa6f8 fix: wrong flag type
Signed-off-by: jonyhy <yun.hao@daocloud.io>
2021-09-29 16:22:51 +08:00
jonyhy
da16d492cd feat: support import image for specific platform
Signed-off-by: jonyhy <yun.hao@daocloud.io>
2021-09-29 14:00:17 +08:00
Kohei Tokunaga
6875aa5d37 import: Add option to skip creating digest image
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-09-15 20:20:57 +09:00
Mike Brown
391b123a5e adds quiet option for ref
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2021-04-20 09:20:14 -05:00
Mike Brown
00f8d32ef5 add not found debug out for check cmd; update usage
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2021-04-19 19:36:10 -05:00
Wei Fu
f8c2f04756 remotes/ctr: allow to limit max concurrent uploads like downloads
Also add flags for push/pull subcommand to limit max concurrent
uploads/downloads.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-03-25 14:37:02 +08:00
Maksym Pavlenko
22ef69d77d Support HTTP debug in ctr
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-03-22 09:32:34 -07:00
Iceber Gu
231bbdc379
cmd/ctr: fix export command
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2021-03-15 13:22:56 +08:00
Alakesh Haloi
9f5244f410 Print elapsed time for image unpack
The provides additional insight into how much time is being spent in
unpacking and is helpful in performance comparison for just this stage
without resorting to running under time command in linux for example.

Signed-off-by: Alakesh Haloi <alakeshh@amazon.com>
2021-03-09 06:40:49 +00:00
Phil Estes
51992133af
Allow HTTP tracing in push/pull via --trace flag
Signed-off-by: Phil Estes <estesp@amazon.com>
2021-03-02 20:33:35 -05:00
Akihiro Suda
5ca3ac65c4
add Image content converter
Go example:
```go
opts := []converter.Opt{
  // convert Docker media types to OCI ones
  converter.WithDocker2OCI(true),
  // convert tar.gz layers to uncompressed tar layers
  converter.WithLayerConvertFunc(uncompress.LayerConvertFunc),
}
srcRef := "example.com/foo:orig"
dstRef := "example.com/foo:converted"
dstImg, err = converter.Convert(ctx, client, dstRef, srcRef, opts...)
fmt.Println(dstImg.Target)
```

ctr example: `ctr images convert --oci --uncompress example.com/foo:orig example.com/foo:converted`

Go test: `go test -exec sudo -test.root -test.run TestConvert`

The implementation is from https://github.com/containerd/stargz-snapshotter/pull/224,
but eStargz-specific functions are not included in this PR.

eStargz converter can be specified by importing `estargz` package and using `WithLayerConvertFunc(estargz.LayerConvertFunc)` option.

This converter interface will be potentially useful for converting zstd and ocicrypt layers as well.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-01-22 13:33:19 +09:00
Derek McGowan
392b2857aa
Merge pull request #4848 from katiewasnothere/ctr_image_chainid
Add a new flag to ctr "images pull" to print the image's chainID
2021-01-21 17:11:53 -08:00
Kathryn Baldauf
14df541a40 Add a new flag to images pull for printing out the pulled image's chainID
Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
2021-01-12 15:42:40 -08:00
Akihiro Suda
e2e2c5737d
export: add --skip-non-distributable
The flag skips adding non-distributable blobs such as Windows layers to archive.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-01-01 06:32:01 +09:00
Li Ning
97cee75da8 ctr: fix the incorrect image unmount error hint
Signed-off-by: Li Ning <lining@cmss.chinamobile.com>
2020-11-11 19:57:31 +08:00
Brian Goff
1a10211e3f WithLease: always return context and done fn
We should never return a nil context because of the way this function is
typically used... e.g.

```
  ctx, done, err := containerd.WithLease(ctx)
```

If there is an error `ctx` will be nil and any error handling may cause
an NPE if it tries to use `ctx`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-04-25 21:16:43 -07:00
Brian Goff
98b30f4690 Add commands to mount/unmount image from ref
Example:

```terminal
$ mkdir /opt/busybox
$ ctr image mount docker.io/library/busybox:latest /opt/busybox
/opt/busybox
$ ls -lh /opt/busybox
total 40K
drwxr-xr-x 2 root   root     12K Apr 14 01:10 bin
drwxr-xr-x 2 root   root    4.0K Apr 14 01:10 dev
drwxr-xr-x 3 root   root    4.0K Apr 14 01:10 etc
drwxr-xr-x 2 nobody nogroup 4.0K Apr 14 01:10 home
drwx------ 2 root   root    4.0K Apr 14 01:10 root
drwxrwxrwt 2 root   root    4.0K Apr 14 01:10 tmp
drwxr-xr-x 3 root   root    4.0K Apr 14 01:10 usr
drwxr-xr-x 4 root   root    4.0K Apr 14 01:10 var
$ ctr image unmount /opt/busybox
$ ls -lh /opt/busybox
total 0
```

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-04-25 21:00:21 -07:00
Xiaodong Ye
072dfbaf36 Support pushing a specific platform of a multi-architecture docker image to a registry
Signed-off-by: Xiaodong Ye <xiaodongy@vmware.com>
2019-12-23 17:24:45 +08:00
Derek McGowan
a40c3830df
Add option to pull all metadata
Add flags to pull and fetch to grab all metadata.
Add fetch option to pull only metadata.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-08-26 11:05:21 -07:00
Yu Yi
aae2d0d754
delete unnecessary checks and fix a test
Signed-off-by: Yu Yi <yiyu@google.com>
2019-08-23 14:02:56 -07:00