Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oci-image-tool failed to unpack #188

Closed
jovizhangwei opened this issue Oct 12, 2017 · 7 comments
Closed

oci-image-tool failed to unpack #188

jovizhangwei opened this issue Oct 12, 2017 · 7 comments

Comments

@jovizhangwei
Copy link

[xianwei.zw@buffer010101170038.et2sqa /home/xianwei.zw/gocode/src/github.com/opencontainers/test]
$sudo docker save nginx:alpine | docker2oci nginx

[xianwei.zw@buffer010101170038.et2sqa /home/xianwei.zw/gocode/src/github.com/opencontainers/test]
$tree nginx
nginx
├── blobs
│   └── sha256
│       ├── 040fd7841192c4f283485d5c7817f4508a774a8fabef8fc265c87f4d2a2ae635
│       ├── 9d93ce18f76eb7e55938bc943541010a83227ff6081fa39a168b4c9a21bfed03
│       ├── be269c61895ec0869f6ce83c4fcf22f5b343cfe1c31d69959a6e49af17329b56
│       ├── c0326cfaf747aa2703fa448edf24f9638ba7e6b36dda7f7a97a53039b5a8c83b
│       ├── de88aa7ce14e79addca455533ec2c8e0ecce7153077b7c0312e834728e90e182
│       └── e84831b3be3298529fffc9c4b19aa83ee080906d614923ac6d2e6e688913e4ea
├── index.json
└── oci-layout

2 directories, 8 files

[xianwei.zw@buffer010101170038.et2sqa /home/xianwei.zw/gocode/src/github.com/opencontainers/test]
$oci-image-tool create --ref alpine nginx bundle/
symlink /bin/busybox bundle/rootfs/usr/bin/strings: file exists
error unpack: extracting layer
github.com/opencontainers/image-tools/image.(*manifest).unpack.func2
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/image/manifest.go:127
github.com/opencontainers/image-tools/image.(*pathWalker).walk.func1
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/image/walker.go:162
path/filepath.walk
	/home/xianwei.zw/go/src/path/filepath/path.go:351
path/filepath.walk
	/home/xianwei.zw/go/src/path/filepath/path.go:376
path/filepath.walk
	/home/xianwei.zw/go/src/path/filepath/path.go:376
path/filepath.walk
	/home/xianwei.zw/go/src/path/filepath/path.go:376
path/filepath.Walk
	/home/xianwei.zw/go/src/path/filepath/path.go:398
github.com/opencontainers/image-tools/image.(*pathWalker).walk
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/image/walker.go:163
github.com/opencontainers/image-tools/image.(*manifest).unpack
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/image/manifest.go:131
github.com/opencontainers/image-tools/image.createBundle
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/image/image.go:337
github.com/opencontainers/image-tools/image.createRuntimeBundle
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/image/image.go:288
github.com/opencontainers/image-tools/image.CreateRuntimeBundleLayout
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/image/image.go:235
main.createHandle
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/cmd/oci-image-tool/create.go:62
github.com/opencontainers/image-tools/vendor/github.com/urfave/cli.HandleAction
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/vendor/github.com/urfave/cli/app.go:485
github.com/opencontainers/image-tools/vendor/github.com/urfave/cli.Command.Run
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/vendor/github.com/urfave/cli/command.go:193
github.com/opencontainers/image-tools/vendor/github.com/urfave/cli.(*App).Run
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/vendor/github.com/urfave/cli/app.go:250
main.main
	/home/xianwei.zw/gocode/src/github.com/opencontainers/image-tools/cmd/oci-image-tool/main.go:57
runtime.main
	/home/xianwei.zw/go/src/runtime/proc.go:185
runtime.goexit
	/home/xianwei.zw/go/src/runtime/asm_amd64.s:2197
@cyphar
Copy link
Member

cyphar commented Oct 12, 2017

I believe this is caused by us not removing an existing file if the type has changed on extraction.

As an aside, if you'd like to take a look at another tool for manipulating OCI images, I'd recommend umoci (which is a tool I wrote and we use quite heavily at SUSE).

@coolljt0725
Copy link
Member

same issue #41 and may fixed by #42?

@jovizhangwei
Copy link
Author

jovizhangwei commented Oct 12, 2017

umoci is also not working.

$sudo docker save nginx:alpine | docker2oci nginx

$umoci unpack --image nginx:alpine rootfs
   ⨯ create runtime bundle: chown rootfs: lchown rootfs/rootfs: operation not permitted

$sudo umoci unpack --image nginx:alpine rootfs
   ⨯ create runtime bundle: create gzip reader: gzip: invalid header

Use containerd's ctr to export OCI image:

$sudo ctr images export nginx.tar docker.io/library/nginx:alpine

$mkdir nginx

$tar xvf nginx.tar -C nginx/
blobs/
blobs/sha256/
blobs/sha256/019300c8a437a2d60248f27c206795930626dfe7ddc0323d734143bd5eb131a6
tar: blobs/sha256/019300c8a437a2d60248f27c206795930626dfe7ddc0323d734143bd5eb131a6: implausibly old time stamp 1970-01-01 08:00:00
blobs/sha256/21a2450d623e05fa6a3e3837a7f113cdb937e75d16b345eb9ef4df0de6bb38a4
tar: blobs/sha256/21a2450d623e05fa6a3e3837a7f113cdb937e75d16b345eb9ef4df0de6bb38a4: implausibly old time stamp 1970-01-01 08:00:00
blobs/sha256/51eec16c884211bfb082f108235fd481b01e254ef5755034aa0f51287fc55d62
tar: blobs/sha256/51eec16c884211bfb082f108235fd481b01e254ef5755034aa0f51287fc55d62: implausibly old time stamp 1970-01-01 08:00:00
blobs/sha256/671afb97c8885a8a7b4e3ac38d3f0d62de0128e780cae695fd0994bd269131f1
tar: blobs/sha256/671afb97c8885a8a7b4e3ac38d3f0d62de0128e780cae695fd0994bd269131f1: implausibly old time stamp 1970-01-01 08:00:00
blobs/sha256/7ccd7cf6f91ac0f997ed4f2cdd3a2bfedc3a4cedd437100c3222ca47818d7e54
tar: blobs/sha256/7ccd7cf6f91ac0f997ed4f2cdd3a2bfedc3a4cedd437100c3222ca47818d7e54: implausibly old time stamp 1970-01-01 08:00:00
blobs/sha256/83f10f82722087e6944e0348b2e64a95baf247135de7c237f4dec7729a386d7f
tar: blobs/sha256/83f10f82722087e6944e0348b2e64a95baf247135de7c237f4dec7729a386d7f: implausibly old time stamp 1970-01-01 08:00:00
blobs/sha256/850cc6f9f6a14c780560e05b7348ae75801d87c58b6f54b559106b7bc8fa9647
tar: blobs/sha256/850cc6f9f6a14c780560e05b7348ae75801d87c58b6f54b559106b7bc8fa9647: implausibly old time stamp 1970-01-01 08:00:00
index.json
tar: blobs/sha256: implausibly old time stamp 1970-01-01 08:00:00
tar: blobs: implausibly old time stamp 1970-01-01 08:00:00
tar: index.json: implausibly old time stamp 1970-01-01 08:00:00
oci-layout
tar: oci-layout: implausibly old time stamp 1970-01-01 08:00:00

$ls nginx
blobs  index.json  oci-layout

$sudo umoci unpack --image nginx:alpine rootfs
   ⨯ get manifest: load: cas blob: unsupported mediatype: application/vnd.docker.distribution.manifest.list.v2+json

@zhouhao3
Copy link

I can do that in #42 . @coolljt0725 Shell we merge #42 to solve this problem?

@jovizhangwei
Copy link
Author

@q384566678 I got this after merged #42 locally.

$ls nginx
blobs  index.json  oci-layout

$oci-create-runtime-bundle nginx bundle
unpacking failed: refs/v1.0: descriptor not found

@zhouhao3
Copy link

zhouhao3 commented Oct 12, 2017

@jovizhangwei After you merged this, you need to git rebase master first, and then make tool.

@jovizhangwei
Copy link
Author

Oh, it works, #42 indeed fixed my problem. Thanks guys. @coolljt0725 @q384566678 @cyphar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants