Answers: <p>Not optimal approach for the images part:</p>
  <ol>
  <li>List images in ctr:</li>
  </ol>
  <blockquote>
  <p>sudo ctr -n=namespace image ls</p>
  </blockquote>
  <ol start="2">
  <li>Export images from ctr:</li>
  </ol>
  <blockquote>
  <p>sudo ctr -n=namespace image export image_name.tar
  path/to/the/ref:version</p>
  </blockquote>
  <ol start="3">
  <li>Load it into Docker:</li>
  </ol>
  <blockquote>
  <p>docker load --input image_name.tar</p>
  </blockquote>
  
Answers: CC BY-SA 4.0
Answers: 2024-09-13T14:36:39.873Z
Answers: 2024-09-13T14:36:39.873Z
Answers: Senior Engineer
Body: <p>The running container displayed in output of <code>docker ps -a</code> could be seen in the output of <code>ctr -n moby container ls</code>. This container was created by the docker engine and one can view it in the same namespace (moby) with ctr CLI. I tried doing vice versa meaning - running a container using ctr CLI and checking if it is present in docker ps output. Result? Didn't find it.</p>
  <p>Similar experiment was tried with the images as well, the image pull from ctr was not reflecting in the docker images output.</p>
  <p>Is there a way I can use ctr commands to reflect the results in docker system output?</p>
  <p>PS I tried giving <code>moby</code> namespace in ctr commands, tried giving <code>rootfs</code> as runc root in ctr command.</p>
  
Tags: <docker><containerd>
Title: Sharing the containers and images between ctr and docker
UserDisplayName: user33456
ThreadText: # Sharing the containers and images between ctr and docker
  
  (Asked by: username_0 on 2023-06-27)
  
  The running container displayed in output of `docker ps -a` could be seen in the output of `ctr -n moby container ls`. This container was created by the docker engine and one can view it in the same namespace (moby) with ctr CLI. I tried doing vice versa meaning - running a container using ctr CLI and checking if it is present in docker ps output. Result? Didn't find it.
  
  Similar experiment was tried with the images as well, the image pull from ctr was not reflecting in the docker images output.
  
  Is there a way I can use ctr commands to reflect the results in docker system output?
  
  PS I tried giving `moby` namespace in ctr commands, tried giving `rootfs` as runc root in ctr command.
  
  **Tags:** docker, containerd
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-09-13. Score: 0
  
  Not optimal approach for the images part:
  
  1. List images in ctr:
  
  > sudo ctr -n=namespace image ls
  
  2. Export images from ctr:
  
  > sudo ctr -n=namespace image export image\_name.tar
  > path/to/the/ref:version
  
  3. Load it into Docker:
  
  > docker load --input image\_name.tar
  
  
  ---
  
  