redroid-doc
redroid-doc copied to clipboard
使用docker构建新镜像,dockerfile 使用RUN 出现 ‘exec /bin/sh: no such file or directory’
您好,想在您镜像的基础上构建新的镜像发现dockerfile 中无法使用RUN,同时我也尝试将命令放在shell脚本中并压缩上传到镜像里同样也是出现exec /bin/sh: no such file or directory
dockerfile
FROM redroid/redroid:11.0.0-latest
ADD test.tar.gz /
RUN tar xzf /test.tar.gz -C / && \
chmod +x /t.sh && \
/t.sh
# 清理临时文件
RUN rm -rf /test /install.sh
As I mentioned in https://github.com/remote-android/redroid-doc/issues/559#issuecomment-1884546120 , should avoid RUN commands in Dockerfile. Try ONLY ADD tarballs to base redroid image.
Futher explanation (redroid 11):
$ readelf -d system/bin/sh
Dynamic section at offset 0x4d820 contains 29 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libc.so]
0x000000000000001e (FLAGS) BIND_NOW
$ ls -al system/lib64/libc.so
lrwxrwxrwx 1 frank frank 46 Oct 23 10:35 system/lib64/libc.so -> /apex/com.android.runtime/lib64/bionic/libc.so
## APEX are setup during bootup; thus it's not easy to run sh directly