I’m trying to create a container called pny using my local pny-img that I just successfully built using the root user.
My build docker build /home/pny-build/ -t root/pny-img:latest
Why does docker think I want root:latest? (also I have not published to docker hub nor do I want to)
root@h:/# docker run -itd --ip6 --user root --mount /home/host:/home/msg -v pny-data:/home/PNY/data --name pny root/pny-img:latest
Unable to find image 'root:latest' locally
docker: Error response from daemon: pull access denied for root, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
root/pny-img latest e155807a2b41 13 minutes ago 154MB
<none> <none> 3e69001ca458 20 minutes ago 100MB
root/peonyd latest afec8964fc47 25 hours ago 149MB
ubuntu 22.04 2dc39ba059dc 9 days ago 77.8MB
docker latest 0dfb722b2a54 2 weeks ago 134MB
Even if I use the image id
root@h:/# docker run -itd --ip6 --user root --mount /home/host:/home/msg -v pny-data:/home/PNY/data --name pny e155807a2b41
Unable to find image 'root:latest' locally
That’s a strange behavior. Haven’t seen it before. Though, I never used the context as first argument, as the documentation says:
Usage: docker build [OPTIONS] PATH | URL | -
The context is either a path, an url or a Dockerfile piped in using stdin.
It is not necessary to publish the image before using it. Many images use dashes. So make sure yours uses an actual typed dash. Apart from those suggestions: I have no idea why you experience what your experience.
Typed with the keyboard. Sometimes if text is copied from documents or web pages, it happens that characters that look like a dash are copied, but in fact are not the dash character.
And that was always missing. That’s why --user became the argument of --ip6 and root is just an argument of docker run. Since the first argument of docker run is the image name, it tried to run root:latest