docker - docker 本地注册表“exec:\”htpasswd\“:$PATH 中找不到可执行文件”
问题描述
直到最近这还不错
docker run --entrypoint htpasswd registry:2 -Bbn myuser mypwd > /my/registry2/reg/hub/auth/htpasswd
现在它出错了
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"htpasswd\": executable file not found in $PATH": unknown.
这是在带有 docker 的 Ubuntu 18.04 和 20.04 上
docker version
Client: Docker Engine - Community
Version: 19.03.11
API version: 1.40
Go version: go1.13.10
Git commit: 42e35e61f3
Built: Mon Jun 1 09:12:22 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.11
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 42e35e61f3
Built: Mon Jun 1 09:10:54 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
解决方案
如果您将本地 docker 注册表固定到
registry:2.7.0
而不是通过使用 which 来获取最新版本 2registry:2
可悲地坏了
有关详细信息,请参阅 https://github.com/docker/distribution-library-image/commit/ab00e8dae12d4515ed259015eab771ec92e92dd4(他们删除了包 apache2-utils)和 https://github.com/GoogleContainerTools/jib/pull/2538/commits/f816c837e34eb389c2dee1bc9a2918c 和 https://github.com/GoogleContainerTools/jib/pull/2539在https://github.com/docker/distribution-library-image/issues/106中引用
或者,您可以使用以下命令安装二进制 htpasswd,而不是从注册表内部执行 htpasswd:2
apt-get install apache2-utils # thankfully this is NOT the apache server
并使用语法
htpasswd -Bbn myuser mypwd > /my/registry2/reg/hub/auth/htpasswd
在 Ubuntu 18.04 或 20.04 上
PS这里是来自包apache2-utils的所有文件......只是一些实用程序而不是任何服务器
dpkg -L apache2-utils
/.
/usr
/usr/bin
/usr/bin/ab
/usr/bin/checkgid
/usr/bin/fcgistarter
/usr/bin/htcacheclean
/usr/bin/htdbm
/usr/bin/htdigest
/usr/bin/htpasswd
/usr/bin/logresolve
/usr/bin/rotatelogs
/usr/sbin
/usr/sbin/check_forensic
/usr/sbin/httxt2dbm
/usr/sbin/split-logfile
/usr/share
/usr/share/doc
/usr/share/doc/apache2-utils
/usr/share/doc/apache2-utils/changelog.Debian.gz
/usr/share/doc/apache2-utils/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/ab.1.gz
/usr/share/man/man1/htdbm.1.gz
/usr/share/man/man1/htdigest.1.gz
/usr/share/man/man1/htpasswd.1.gz
/usr/share/man/man1/httxt2dbm.1.gz
/usr/share/man/man1/logresolve.1.gz
/usr/share/man/man8
/usr/share/man/man8/check_forensic.8.gz
/usr/share/man/man8/checkgid.8.gz
/usr/share/man/man8/fcgistarter.8.gz
/usr/share/man/man8/htcacheclean.8.gz
/usr/share/man/man8/rotatelogs.8.gz
/usr/share/man/man8/split-logfile.8.gz
为了更好的衡量,我在这个https://github.com/docker/docker.github.io/issues/11060上为 docker 订了一张票
推荐阅读
- spring - SpringBoot 无法在 webapp 文件夹中提供 jsp 文件
- java - 管理 JFrame 实例
- json - 如何在 SQL Server 2017 中导入以 UTF-8 编码的 JSON 文件,保留国际字符,避免“mojibake”?
- android - ORMLite 与 Android 数据库连接
- c++ - C++ 类不打印?
- django - Axios 标头适用于 Django GET 请求,但不适用于 PUT 请求
- python-3.x - 在 python 中从 PIL 导入图像的问题
- rest - 在同一个 Rest API 中有不同的路径
- java - 单例 Java 类可以有静态常量变量吗?声纳棉绒错误
- dart - 绘制从远程服务器下载的图像