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.
Answer
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.