1

I have a Dockerfile that I plan to use for test/deployments. Been running these commands both on visual studio code as well directly from command line.

sample below.

FROM ubuntu:20.04
WORKDIR /app

I have created image from command line, I can see this on Docker Desktop I am able to run container from docker desktop

Sample command

docker build - t imageubuntu1 .

When I run below command, it gives the images

docker images

However when I try creating container from above image ir errors out

command
docker run -d --name container1 imageubuntu1

Error

Unable to find image 'imageubuntu1:latest' locally
docker : Error response from daemon: pull access denied for imageubuntu1, repository does not exist or may require "docker login"

I am logged into docker.

What could be preventing the access of images from command line?

This is an error I see on my windows laptop at work. I have not seen these errors when working with my macbook, also a work laptop.

1
  • Is it just that you have a typo? The option for setting the tag should be -t (note the lack of a space). Otherwise, what does docker images show? Please add that to your question. Commented Jul 12 at 15:47

2 Answers 2

0

Your build command has a space typo: - t instead of -t. This causes the image to be untagged, so docker run can’t find imageubuntu1.

  1. Rebuild with the right syntax: docker build -t imageubuntu1 .

  2. Run your container: docker run -d container1 imageubuntu1

Sign up to request clarification or add additional context in comments.

Comments

-1

You don't need to login docker in case you want to run locally built image.

Issue seems to be cuz of :latest in the image name. By default, docker run command will append latest tag to image name if you haven't specified. Since the tag applied image name is different to your locally built one, docker CLI automatically looks for that image on docker hub, and that is why it asks for login.

You can try with docker build -t imageubuntu1:latest ., and run that image.

1 Comment

:latest is appended everywhere by default, including not just docker run but also docker build -t, docker push, docker pull, &c.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.