skip to Main Content

I want to create my own image and push it into my docker-hub.

Prepare:

mkdir /tmp/mydebian
cd  /tmp/mydebian
vim  mydebian.Dockerfile
#all contents omitted here

Build the image with Dockerfile:

docker build -f mydebian.Dockerfile --tag=mydebian:0.0.1 .

Check it:

docker images
REPOSITORY            TAG        IMAGE ID       CREATED         SIZE
mydebian              0.0.1      bd66705654b1   5 minutes ago   460MB

Login docker:

docker login -u "myusername" -p "xxxxxxxx" docker.io

Push now:

docker push myusername/mydebian:0.0.1
The push refers to repository [docker.io/myusername/mydebian]
An image does not exist locally with the tag: myusername/mydebian

Try other format:

docker push mydebian:0.0.1
The push refers to repository [docker.io/library/mydebian]
690c901c038e: Preparing 
1155352a0b68: Preparing 
1201adb8bea9: Preparing 
a13c519c6361: Preparing 
denied: requested access to the resource is denied

How can fix it?

2

Answers


  1. Leave out the docker.io in the end for the login command. Like this:

    docker login -u "myusername" -p "xxxxxxxx"
    

    Same error with a longer description

    Login or Signup to reply.
  2. You need to tag your images with the name they’ll be pushed with. Either on build:

    docker build -f mydebian.Dockerfile --tag=myusername/mydebian:0.0.1 .
    

    Or to give an existing image an additional tag:

    docker tag mydebian:0.0.1 myusername/mydebian:0.0.1
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search