守护进程的错误响应:无效的容器名(tomcat:8.0),只有[a-zA-Z0-9][a-zA-Z0-9_。-]允许

时间:2021-10-15 17:02:15

I'm trying to run a docker container by Vagrant Docker provision:

我试图通过流浪码头工人条款来运行码头工人集装箱:

d.run "tomcat:8.0", args: "-it -d -p 8888:8888 --name tomcat8"

Vagrant pulls the image fine, but when it comes to running the container I get a:

流浪者把图像拉得很好,但当它运行容器时,我得到:

Error response from daemon: Invalid container name (tomcat:8.0), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed

守护进程的错误响应:无效的容器名(tomcat:8.0),只有[a-zA-Z0-9][a-zA-Z0-9_。-]允许

I would like to keep the :8.0 so that I'm sure I run the right image version.

我想保持:8.0,以便我确定我运行了正确的图像版本。

1 个解决方案

#1


1  

Well it turned out that Vagrant by default uses the image name as container name even if I used the --name arg.

结果证明,流浪者默认使用图像名作为容器名即使我使用-name arg。

In my case that was unfortunate since I was pulling from the official Tomcat repository at Dockerhub and hence could not change the image name.

在我的例子中,这很不幸,因为我是从Dockerhub的Tomcat存储库中提取的,因此无法更改映像名。

What I found was that Vagrant has an extra setting called auto_assign_name which must be set to false in order to use the --name arg.

我发现,为了使用-name arg, Vagrant有一个名为auto_assign_name的额外设置,必须将其设置为false。

So a working Vagrant line would be:

因此,一条工作的流浪线应该是:

d.run "tomcat:8.0", args: "-it -p 8080:8080 --name tomcat8", auto_assign_name: false

#1


1  

Well it turned out that Vagrant by default uses the image name as container name even if I used the --name arg.

结果证明,流浪者默认使用图像名作为容器名即使我使用-name arg。

In my case that was unfortunate since I was pulling from the official Tomcat repository at Dockerhub and hence could not change the image name.

在我的例子中,这很不幸,因为我是从Dockerhub的Tomcat存储库中提取的,因此无法更改映像名。

What I found was that Vagrant has an extra setting called auto_assign_name which must be set to false in order to use the --name arg.

我发现,为了使用-name arg, Vagrant有一个名为auto_assign_name的额外设置,必须将其设置为false。

So a working Vagrant line would be:

因此,一条工作的流浪线应该是:

d.run "tomcat:8.0", args: "-it -p 8080:8080 --name tomcat8", auto_assign_name: false