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

[feature required] pouch support load and tag #1163

Closed
changyaowei opened this issue Apr 19, 2018 · 3 comments
Closed

[feature required] pouch support load and tag #1163

changyaowei opened this issue Apr 19, 2018 · 3 comments
Assignees

Comments

@changyaowei
Copy link
Contributor

Ⅰ. Issue Description

Pouch not support

pouch load
pouch tag

Ⅱ. Describe what happened

With out pouch load and pouch tag ,if network is isolation,we can't get some images

pouch version
GitCommit: unknown
GoVersion: go1.9.1
KernelVersion: 3.10.0-327.ali2012.alios7.x86_64
Os: linux
Version: 0.4.0-dev
APIVersion: 1.24
Arch: amd64
BuildTime: unknown

@fuweid fuweid self-assigned this Apr 19, 2018
@fuweid
Copy link
Contributor

fuweid commented May 30, 2018

Hi @112101160 , pouch has tag and load functionality right now. For your case, I think we can use pouch load to handle your case. Since the docker image format is quite different from oci image, we need the third-party to do the conversion. please check the following script. First argu is dockerImageTarfile and second argu is image name.

And please have a try. Thanks

#!/usr/bin/env bash

set -euo pipefail

# check_docker2oci checks the docker2oci command has been installed.
check_docker2oci() {
  command -v docker2oci > /dev/null || {
    echo >&2 "required docker2oci command, please use 'go get -u github.com/coolljt0725/docker2oci'"
    exit 1
  }
}

# import_image imports images.
import_image() {
  local tarfile name tmpdir tmptar

  tarfile=$1
  name=$2

  # docker image format to oci format in tmpdir
  tmpdir=$(mktemp -d -t 'tmpimagedir.XXXXX')
  docker2oci -i "${tarfile}" "${tmpdir}"

  # make oci tar
  tmptar=$(mktemp -t 'tmpimagetar.XXXXX.tar')
  tar -C "${tmpdir}" -cf "${tmptar}" ./

  # load oci tar
  pouch load -i "${tmptar}" "${name}"
}

main() {
  check_docker2oci
  import_image "$@"
}

main "$@"
➜  docker2pouch pouch images
IMAGE ID   IMAGE NAME   SIZE
➜  docker2pouch docker save reg.docker.alibaba-inc.com/base/busybox:1.24 -o test.tar
➜  docker2pouch ./import_image.sh test.tar haha
➜  docker2pouch pouch images
IMAGE ID       IMAGE NAME   SIZE
39048fca3575   haha:1.24    1.25 MB

@allencloud
Copy link
Collaborator

Does this meet your demand? If the answer is yes, please help to close this issue. Thanks a lot. We will absolutely take your demand as the highest priority. 😄

@changyaowei
Copy link
Contributor Author

LGTM

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

No branches or pull requests

4 participants