docker:未授权:需要身份验证

时间:2016-12-05 18:23:34

标签: docker

我正在尝试下载并启动这样的docker容器:

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

然而,下载中途停止,我得到了这个:

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

所以我看了看这里: docker unauthorized: authentication required - upon push with successful login

我试过了:

docker push  mydockerhubusername/somerepo:latest

但我得到了:

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

我的~/.docker/config.json看起来像这样:

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

那么如何下载容器?

1 个答案:

答案 0 :(得分:0)

您不下载容器。您下载图像,然后在该图像上执行docker run,然后启动容器。为此,图像必须存在于某个地方 - 在某些Docker注册表中,如公共IEEE Std 1800-2012或您的私人注册表或本地计算机。如果本地计算机上不存在docker run,则默认情况下会从DockerHub尝试docker pull,或者如果您登录到私有注册表,则从私有注册表尝试docker push

如果要将映像从本地计算机推送到注册表,则必须登录计算机上的该注册表,创建存储库,构建映像,然后docker run java将映像设置为存储库,以便您可以从其他地方下载它并启动容器。当然,要构建一个图像,你需要一个Dockerfile,或者你的项目中的一些插件,它会自动为你构建它。

Ex:Java图片已经发布,我的机器上没有它,所以当我docker pull时,~ $: 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 的图片开始 //firebug params and success message output item[]=2&item[]=1&item[]=3&item[]=4&item[]=5&item[]=6&item[]=7&item[]=8&item[]=9&item[]=10 //request header Host: example.com User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0 Accept: */* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://example.com/PropertyIndex/property_gallery/draggable.php Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest Content-Length: 90 Cookie: PHPSESSID=b1lr9he4l2hbcnlkcsebfq2134 Connection: keep-alive //request body item[]=1&item[]=3&item[]=2&item[]=4&item[]=5&item[]=6&item[]=7&item[]=8&item[]=9&item[]=10

            filename: draggable.php

                <!doctype html>
                <html lang="en">
                <head>
                  <meta charset="utf-8">
                  <meta name="viewport" content="width=device-width, initial-scale=1">
                  <title>jQuery UI Sortable - Display as grid</title>
                  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
                  <link rel="stylesheet" href="/resources/demos/style.css">
                  <style>
                  #sortable { list-style-type: none; margin: 0; padding: 0; width: 450px; }
                  #sortable li { margin: 3px 3px 3px 0; padding: 1px; float: left; width: 100px; height: 90px; font-size: 4em; text-align: center; }
                  </style>
                  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
                  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
                  <script>
                  $( function() {
                    $( "#sortable" ).sortable();
                    $( "#sortable" ).disableSelection();
                  } );
                  </script>
                </head>
                <body>

                <?php
                <!-----------get media_urls from database----------------->

                 <div id="element">
                <ul id="sortable">


                <li id="item-1" class="ui-state-default">     <img class="image" src="<?php echo $media_url1 ?>" width="100px" height="100px">       </li>
                <li id="item-2" class="ui-state-default">     <img class="image" src="<?php echo $media_url1 ?>" width="100px" height="100px">       </li>
                <li id="item-3" class="ui-state-default">     <img class="image" src="<?php echo $media_url2 ?>" width="100px" height="100px">       </li>
                <li id="item-4" class="ui-state-default">     <img class="image" src="<?php echo $media_url3 ?>" width="100px" height="100px">       </li>
                <li id="item-5" class="ui-state-default">     <img class="image" src="<?php echo $media_url4 ?>" width="100px" height="100px">       </li>
                <li id="item-6" class="ui-state-default">     <img class="image" src="<?php echo $media_url5 ?>" width="100px" height="100px">       </li>
                <li id="item-7" class="ui-state-default">     <img class="image" src="<?php echo $media_url6 ?>" width="100px" height="100px">       </li>
                <li id="item-8" class="ui-state-default">     <img class="image" src="<?php echo $media_url7 ?>" width="100px" height="100px">       </li>
                <li id="item-9" class="ui-state-default">     <img class="image" src="<?php echo $media_url8 ?>" width="100px" height="100px">       </li>
                <li id="item-10" class="ui-state-default">     <img class="image" src="<?php echo $media_url9 ?>" width="100px" height="100px">       </li>


                </ul>
                //test results
                Query string: <span></span>
                <p class ="result"></p>

                </div>

                //post the data using ahax
                <script>

                $('ul').sortable({

                    update: function (event, ui) {
                        var data = $(this).sortable('serialize');

                         $('span').text(data);      //test success 2

                        $.ajax({
                            data: data,
                            type: 'POST',
                            url: 'draggable.php',
                            success:function(result){
                            $(".result").html(data);}
                        });  

                    }
                });

                //$(window).resize(resize);

                </script>

                <?php

                print_r()//an empty array--but why?

                $i = 0;

                //this loop is failing to echo the success result ie item[]
                foreach ($_POST['item'] as $value) {
                    echo "each".$value;
                    $i++;
                }
                ?>

                </body>
                </html>