Docker命令返回“无效参考格式”(invalid reference format)。 [英] Docker command returns "invalid reference format"

查看:3776
本文介绍了Docker命令返回“无效参考格式”(invalid reference format)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用docker并使用以下命令:

I'am using docker and using the following command:

docker run -d -p 9090:80 -v $(pwd):/usr/share/nginx/html nginx:alpine

指向我的 / dist 文件夹,其中我的应用程序文件是按角度编译的。

to point to my /dist folder where my app-files are compiled by angular.

我首先进入 / dist 文件夹,然后从那里运行命令。一切正常,我可以通过以下端口访问应用程序: 9090 ,但是在docker更新后,我运行错误:

I first go to /dist folder and then run the command from there. This was working fine and I was able to reach the app via port: 9090, but after docker update, I run in error:


docker:无效的引用格式。
请参阅 docker run --help。

docker: invalid reference format. See 'docker run --help'.

我一直在搜索并检查以下帖子docker:无效的参考格式,但这似乎与我的问题不同。
以下是基于命令的信息: docker版本

I have been searching and checked the following posting docker : invalid reference format, but it seems to be different to my issue. Here is the info based on the command: docker version:

Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:40:09 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:45:38 2017
 OS/Arch:      linux/amd64
 Experimental: false

请问有什么想法吗?

推荐答案

Docker在映像名称之前看到了意外的内容,使它认为您的命令中除了 nginx:alpine 是您的图像名称。在您选择每个选项之前,这可能是无效的-,通常会通过网络复制/粘贴看到。它也可能是您的路径中的空间。如果它就像路径中的空格一样简单,则引用它可以解决以下问题:

Docker is seeing something unexpected before the image name, making it think something in your command other than the nginx:alpine is your image name. This may be an invalid - before each of your options, often seen with a copy/paste from the web. It may also be a space in your path. If it's as simple as a space in your path, then quoting it will resolve that:

docker run -d -p 9090:80 -v "$(pwd):/usr/share/nginx/html" nginx:alpine

如果以上两个方法不能解决您的问题,请首先确保以下工作正常:

If the above two do not resolve your issue, first make sure the following works:

docker run nginx:alpine

然后将各个参数重新添加到您的命令中,直到找到破坏它的参数为止。请特别注意args的顺序, run 的参数必须在 run 和图像名称之间。图像名称后的args作为运行命令传递。 运行之前的Args是 docker 顶级命令的选项。

And then add individual parameters back into your command until you find the one that breaks it. Pay special attention to the order of your args, parameters to run must be between the run and your image name. Args after the image name are passed as a command to run. Args before the run are options to the docker top level command.

这篇关于Docker命令返回“无效参考格式”(invalid reference format)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆