What is the difference between import and load in Docker?

前端 未结 3 1684
臣服心动
臣服心动 2020-12-04 19:00

I understand the difference between export (for containers) and save (for images). But at the end of the day the tarball produced by either save or

3条回答
  •  -上瘾入骨i
    2020-12-04 19:16

    As a Docker-newbie, I learnt this difference the hard way.

    • On one system:

      docker run -it myImage /bin/bash
      

      --> Works fine

    • On that same system (using save):

      docker save myImage -o myImage.tar
      
    • On second system (using import):

      docker import myImage.tar
      

      --> Works nicely, no issues, just tag required:

      docker tag _the_assigned_tag myImage
      
    • On that second system:

      docker run -it myImage /bin/bash
      

      docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown.

    Looking for that error brought my to all kinds of reasons such as MountFlags="slave", but the real reason turned out to be the one described in this post: I should have used load instead of import. Not knowing what was going on, Docker's error message didn't put me in any sense on track towards the "import" cause, till I stumbled over this post.

提交回复
热议问题