Skip to content
Latchkey

docker import: Create an Image from a Tarball

Turn a filesystem tarball into a single-layer image.

docker import creates an image from a flat filesystem tar (such as one from docker export or a rootfs). This page covers setting metadata on import and how it differs from docker load.

What it does

docker import reads a tar of a root filesystem and produces a new single-layer image. Because the source has no image config, you typically set CMD/ENTRYPOINT with --change so the image is runnable.

Common usage

Terminal
docker import rootfs.tar myrootfs:latest
docker import --change "CMD [\"/app/start\"]" rootfs.tar myapp:latest
cat rootfs.tar.gz | docker import - myrootfs:latest

Common errors in CI

The imported image runs nothing by default - "docker: Error response from daemon: No command specified" - because import does not carry CMD/ENTRYPOINT. Set them with --change. To restore a full image with history and tags, use docker load (with a docker save archive), not import.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →