'docker:无效的参考格式,当未明确指定docker存储库时

问题描述 投票:2回答:1

我正在通过Gitlab CI在kubernetes中的Docker容器中运行Docker(有一个主映像,并且Dind作为服务)。在吊舱中,我可以构建docker映像并将其推送,但是任何进一步的操作或简单的docker run都会触发无效参考格式的错误。

在Dind服务规范中指定了两个其他不安全的私有存储库。如果我尝试运行未指定回购前缀的docker映像,它将失败。 (请注意,图像在那里,只是它们的标签没有指定存储库)

bash-4.2# docker run hello-world
docker: invalid reference format.
See 'docker run --help'.
bash-4.2# docker run docker.io/hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

bash-4.2# 

我希望基本的docker pull / run命令能够通过并使用守护程序中缓存的图像,即使它们的当前标记不包含指定的存储库。

添加的码头工人信息

Containers: 3
 Running: 1
 Paused: 0
 Stopped: 2
Images: 21
Server Version: 18.09.5
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.14.35-1844.3.2.el7uek.x86_64
Operating System: Alpine Linux v3.9 (containerized)
OSType: linux
Architecture: x86_64
CPUs: 20
Total Memory: 125.5GiB
Name: runner-vppr4q7s-project-14503-concurrent-08qxbj
ID: HQ3U:HATA:TZUT:OLVS:MHRZ:F4DY:ENBD:Z5WH:FQBC:SGI3:BUUY:QIME
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
HTTP Proxy: xxxxxxxx
HTTPS Proxy: xxxxxxx
No Proxy: localhost,127.0.0.1,.xxxxxxxxxx
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 xxxxxxxxxxxx:5000
 yyyyyyyyyyyy:5000
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: API is accessible on http://0.0.0.0:2375 without encryption.
         Access to the remote API is equivalent to root access on the host. Refer
         to the 'Docker daemon attack surface' section in the documentation for
         more information: https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Registries:

另外:

bash-4.2# docker tag docker.io/hello-world:latest hello-world:v1
Error parsing reference: "hello-world:v1" is not a valid repository/tag: invalid reference format
bash-4.2# docker tag docker.io/hello-world:latest some:2000/hello-world:v1
bash-4.2# docker tag docker.io/hello-world:latest docker.io/hello-world:v1
(ok)

[docker images不显示docker.io/hello-world:latestdocker.io/hello-world:v1,但显示some:2000/hello-world:v1

docker gitlab-ci-runner
1个回答
0
投票

这个问题解决了吗?我现在正在遇到一模一样的问题。我使用https://download.docker.com/linux/static/stable/x86_64/docker-19.03.5.tgz

中的压缩包安装了docker

另外,下面的命令:

bash-4.2# docker run hello-world

如果以ROOT身份运行,但会失败,否则会出现相同的错误(docker:无效的引用格式。)

但是如果指定了完整命令,它将作为所有用户使用

bash-4.2# docker run docker.io/hello-world
© www.soinside.com 2019 - 2024. All rights reserved.