What is the difference between import and load in Docker? What is the difference between import and load in Docker? docker docker

What is the difference between import and load in Docker?


docker save will indeed produce a tarball, but with all parent layers, and all tags + versions.

docker export does also produce a tarball, but without any layer/history.

It is often used when one wants to "flatten" an image, as illustrated in "Flatten a Docker container or image" from Thomas Uhrig:

docker export <CONTAINER ID> | docker import - some-image-name:latest

However, once those tarballs are produced, load/import are there to:

  • docker import creates one image from one tarball which is not even an image (just a filesystem you want to import as an image)

Create an empty filesystem image and import the contents of the tarball

  • docker load creates potentially multiple images from a tarred repository (since docker save can save multiple images in a tarball).

Loads a tarred repository from a file or the standard input stream


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.


docker import is mostly used with a tarball that is created out of running container. For Eg. docker export containerID > /home/cntr.tar then import this tarball to an image Eg. docker import /home/cntr.tar mynewimage:tag

Whereas docker load is used to load the image from a tarball that is created from another image. For Eg. docker save > /home/fromimg.tar then load it back with docker load < /home/fromimg.tar

the main difference though docker save/load with image does preserve the image history. Whereas docker export/import with container flattens the image by removing all the history of the container.