2

I am trying to download and start a docker container like this:

docker run -it -p 8000:8000 -p 8060:8060 -h sandbox somegithubrepo bash

However, the downloading stops midway and I get this:

docker: unauthorized: authentication required.
See 'docker run --help'.

So I looked here: docker unauthorized: authentication required - upon push with successful login

I tried this:

docker push  mydockerhubusername/somerepo:latest

But I'm getting:

The push refers to a repository [docker.io/mydockerhubusername/somerepo]
An image does not exist locally with the tag: mydockerhubusername/somerepo

My ~/.docker/config.json looks like this:

{
        "auths": {
                "https://index.docker.io/v1/": {
                        "auth": "someKey"
                }
        }
}

So how can I download the container?

Community
  • 1
  • 1
bsky
  • 19,326
  • 49
  • 155
  • 270
  • For downloading public **docker** repositories, you don't need to be logged in. Please try just pulling the repository with `docker pull reponame`, where `reponame` is something listed at https://hub.docker.com/. Could you please provide some more details on the image you want to download and run? – Andreas Jägle Dec 05 '16 at 18:38
  • you seem to confuse `docker push` and `docker pull`, the first you put on the Docker hub a docker image you have created (and you need to login), the last one you copy a docker image from the Docker hub to your host – user2915097 Dec 05 '16 at 18:40

1 Answers1

0

You don't download a container. You download an image, and then do a docker run on that image which then starts a container. For that to happen, the image has to exist somewhere - either in some Docker registry like the public DockerHub or your private registry or your local machine. If it doesn't exist on your local machine, docker run tries to docker pull it from DockerHub by default, or from the private registry if you're logged into one.

If you want to push the image from your local machine to a registry, you'll have to log into that registry on your machine, create a repository, build the image, and then docker push the image to that repository so that you can download it from somewhere else and start a container. Of course, to build an image, you'll need a Dockerfile, or some plugin in your project which builds it automatically for you.

Ex: Java image has already been published and I don't have it on my machine, so when I do docker run java, it starts to docker pull the image from the official DockerHub repository:

~ $: docker run java
Unable to find image 'java:latest' locally
latest: Pulling from library/java
386a066cd84a: Pull complete
...
...
...
Status: Downloaded newer image for java:latest
The_Tourist
  • 2,048
  • 17
  • 21