Gissipi_453
Gissipi_453

Reputation: 1330

Running a docker image gives - Unable to find image error

On a Ubuntu machine, I have built a docker image of a Python flask project and saved it locally on a folder.

/docker-images/my_flask_project.tar

When I run this using this command -

sudo docker run -d -p 8000:8000 my_flask_project

the error message is -

Unable to find image 'my_flask_project:latest' locally

  1. What is wrong here ?
  2. What is the proper way to build docker image, save it locally and run it ?
  3. I want to give this docker image to a friend via a USB drive, that's why need the local copy.

This is the output for sudo docker images -

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
my_flask_project    latest              a81f138bbf93        17 hours ago        1.31GB
<none>              <none>              d43c7afba099        17 hours ago        1.19GB

Upvotes: 0

Views: 545

Answers (2)

Kaustubh Desai
Kaustubh Desai

Reputation: 416

If you want to share it via a USB in a tar file format, you can use the docker save option and then ask your friend to use the docker load option.

Commands at your end

$ docker save -o filename.tar image_name:tag && gzip filename.tar This will give a tar.gz file which will be less in size than the tar file as we are compressing it.

Transfer the tar.gz file to the USB drive. Once your friend has transferred the tar.gz file on their system, execute the below command.

Commands at your friend's end

$ docker load < filename.tar.gz

This will load the docker image locally into docker's local image store.

Upvotes: 1

dejanualex
dejanualex

Reputation: 4328

One approach concerning image sharing is using Dockerhub private repository:

Set up private repository: https://docs.docker.com/docker-hub/repos/

Login to dockerhub: https://docs.docker.com/engine/reference/commandline/login/

Push desired image: docker push NAME[:TAG]

Upvotes: 1

Related Questions