apk 已安装软件包,但在 Docker 上找不到

我正在使用基于 alpine 的 docker 镜像 firesh/nginx-lua

我按照以下方式安装软件包管理器 luarocks:

/bin/luarocks-3.5.0 # apk update
fetch http://mirrors.aliyun.com/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://mirrors.aliyun.com/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
v3.8.5-66-gccbd6a8ae7 [http://mirrors.aliyun.com/alpine/v3.8/main]
v3.8.5-66-gccbd6a8ae7 [http://mirrors.aliyun.com/alpine/v3.8/community]
OK: 9564 distinct packages available

/bin/luarocks-3.5.0 # apk add luarocks
OK: 53 MiB in 38 packages

/bin/luarocks-3.5.0 # luarocks
sh: luarocks: not found

正如你所看到的,luarocks 已安装,但在我尝试使用它时找不到它。

有任何建议吗,我该如何在此 docker 上安装 luarocks?

点赞
用户2816703
用户2816703

我认为这个镜像并不适合你想要做的事情。这是启用了 NginX with LUA 的镜像。该镜像不包含任何 lua 开发环境。要使用它进行 lua 开发,请先安装 lua

docker run -ti --rm --name test  firesh/nginx-lua  sh                                                                                                                                                / # apk update
fetch http://mirrors.aliyun.com/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://mirrors.aliyun.com/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
v3.8.5-66-gccbd6a8ae7 [http://mirrors.aliyun.com/alpine/v3.8/main]
v3.8.5-66-gccbd6a8ae7 [http://mirrors.aliyun.com/alpine/v3.8/community]
OK: 9564 distinct packages available
/ # apk add lua-dev
(1/4) Installing lua5.1-libs (5.1.5-r7)
(2/4) Installing lua5.1 (5.1.5-r7)
(3/4) Installing pkgconf (1.5.3-r0)
(4/4) Installing lua5.1-dev (5.1.5-r7)
Executing busybox-1.28.4-r3.trigger
OK: 52 MiB in 36 packages
/ # apk add luarocks
(1/7) Installing ca-certificates (20191127-r2)
(2/7) Installing nghttp2-libs (1.39.2-r0)
(3/7) Installing libssh2 (1.9.0-r1)
(4/7) Installing libcurl (7.61.1-r3)
(5/7) Installing curl (7.61.1-r3)
(6/7) Installing luarocks (2.4.4-r0)
(7/7) Installing luarocks5.1 (2.4.4-r0)
Executing busybox-1.28.4-r3.trigger
Executing ca-certificates-20191127-r2.trigger
OK: 54 MiB in 43 packages
/ # luarocks
sh: luarocks: not found
/ # luarocks-
luarocks-5.1        luarocks-admin-5.1
/ # luarocks-5.1 --version
/usr/bin/luarocks-5.1 2.4.4
LuaRocks main command-line interface

执行之后你将拥有 luarocks-5.1 的命令。如果想要不加 -5.1 使用它,执行以下命令

/ # alias luarocks=luarocks-5.1
/ # luarocks
Warning: The directory '/root/.cache/luarocks' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing /usr/bin/luarocks-5.1 with sudo, you may want sudo's -H flag.

LuaRocks 2.4.4, the Lua package manager
...
...
2021-02-25 11:40:03