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

Crictl not support load images? #546

Closed
prodanlabs opened this issue Oct 9, 2019 · 8 comments
Closed

Crictl not support load images? #546

prodanlabs opened this issue Oct 9, 2019 · 8 comments

Comments

@prodanlabs
Copy link

I don't see the command for load or tag

[root@kube-master01 ~]# crictl -h
NAME:
   crictl - client for CRI

USAGE:
   crictl [global options] command [command options] [arguments...]

VERSION:
   v1.16.1

COMMANDS:
   attach              Attach to a running container
   create              Create a new container
   exec                Run a command in a running container
   version             Display runtime version information
   images, image, img  List images
   inspect             Display the status of one or more containers
   inspecti            Return the status of one or more images
   imagefsinfo         Return image filesystem info
   inspectp            Display the status of one or more pods
   logs                Fetch the logs of a container
   port-forward        Forward local port to a pod
   ps                  List containers
   pull                Pull an image from a registry
   run                 Run a new container inside a sandbox
   runp                Run a new pod
   rm                  Remove one or more containers
   rmi                 Remove one or more images
   rmp                 Remove one or more pods
   pods                List pods
   start               Start one or more created containers
   info                Display information of the container runtime
   stop                Stop one or more running containers
   stopp               Stop one or more running pods
   update              Update one or more running containers
   config              Get and set crictl options
   stats               List container(s) resource usage statistics
   completion          Output shell completion code
   help, h             Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --config value, -c value            Location of the client config file. If not specified and the default does not exist, the program's directory is searched as well (default: "/etc/crictl.yaml") [$CRI_CONFIG_FILE]
   --debug, -D                         Enable debug mode
   --image-endpoint value, -i value    Endpoint of CRI image manager service [$IMAGE_SERVICE_ENDPOINT]
   --runtime-endpoint value, -r value  Endpoint of CRI container runtime service (default: "unix:///var/run/dockershim.sock") [$CONTAINER_RUNTIME_ENDPOINT]
   --timeout value, -t value           Timeout of connecting to the server (default: 2s)
   --help, -h                          show help
   --version, -v                       print the version
[root@kube-master01 ~]# 
@feiskyer
Copy link
Member

feiskyer commented Oct 13, 2019

@prodanlabs right, load image is not part of CRI.

@ghost
Copy link

ghost commented May 11, 2020

how to solve ?

@feiskyer
Copy link
Member

@mrshengzyzy load images is part of CRI API, hence it won't be supported.

@gebi
Copy link

gebi commented Jun 20, 2020

sorry but your answer is really hard to understand without already knowing the answer.
(eg. why should it not be supported when it's part of the CRI API and this is cri-tools?!)

Then answer is, that there is an additional tool called ctr ("containerd CLI") that is able to do this.

Command:

% crt image import --base-name foo/bar container_import.tar
unpacking foo/bar:VERSION (sha256:123ff...123ff)...done
ctr import --base-name    4,49s user 0,95s system 23% cpu 22,719 total

Nice writeup: https://blog.scottlowe.org/2020/01/25/manually-loading-container-images-with-containerd/

Hint, if you are using containerd with kubernetes, there are 2 additional pitfalls:

  1. the default containerd socket might be at a different location than the default location ctr is looking for
  2. kubernetes uses containerd in a different namespace than the default one.
# show namespaces
% ctr -a /var/run/kube-containerd/containerd.sock namespace ls
NAME    LABELS
default
k8s.io

# import into namespace k8s.io
% ctr -a /var/run/kube-containerd/containerd.sock --namespace k8s.io image import --base-name foo/bar container_import.tar
unpacking foo/bar:VERSION (sha256:123ff...123ff)...done
ctr import --base-name    4,49s user 0,95s system 23% cpu 22,719 total

# check import with
% ctr -a /var/run/kube-containerd/containerd.sock --namespace k8s.io image ls
REF TYPE DIGEST SIZE PLATFORMS LABELS
...

@XiaoXiaoSN
Copy link

I have the same issue, and the podman help me to resolve it.

podman save -o alpine.tar alpine:3.13
podman load -i alpine.tar

@dogukancagatay
Copy link

I use skopeo for load/save operations on cri-o.

# Saving
skopeo copy containers-storage:docker.io/weaveworks/weave-npc:2.8.1 dir:image-output-dir
# Loading
skopeo copy dir:image-output-dir containers-storage:docker.io/weaveworks/weave-npc:2.8.1

@xuegege5290
Copy link

I have the same issue, and the podman help me to resolve it.

How to configure the podman as the runtime with cri-o daemon?

@mjbright
Copy link

I have the same issue, and the podman help me to resolve it.

podman save -o alpine.tar alpine:3.13
podman load -i alpine.tar

So obvious ... as podman or skopeo are from the same eco-system.

But was missing from this issue which was pointing in the direction of ctr.

Thanks!

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

7 participants