【DockerFile】解密失败的解决方案:揭秘Process "/bin/sh -c yum install openssl"的报错

大家好 我是寸铁👊
【Centos7】【DockerFile】解密失败的解决方案:揭秘Process "/bin/sh -c yum install openssl"的报错✨
喜欢的小伙伴可以点点关注 💝

前言

今天笔者在编写dockerfile的时候,报错了,咋一看编写的指令是没问题的,那是哪里出现了问题呢?下面跟着笔者来看看怎么解决这个问题吧!

报错如下:

ERROR [2/9] RUN yum install openssl                                                                                                                                                                                                       20.6s 

  [2/9] RUN yum install openssl:
20.31 ================================================================================
20.31  Package            Arch         Version                    Repository     Size
20.31 ================================================================================
20.31 Installing:
20.31  openssl            x8664       1:1.0.2k-26.el79          updates       494 k
20.31 Installing for dependencies:
20.31  make               x8664       1:3.82-24.el7              base          421 k
  20.31 Updating for dependencies:
  20.31  openssl-libs       x8664       1:1.0.2k-26.el79          updates       1.2 M
  20.31
  20.31 Transaction Summary
  20.31 ================================================================================
  20.31 Install  1 Package  (+1 Dependent package)
  20.31 Upgrade             ( 1 Dependent package)
  20.31
  20.31 Total download size: 2.1 M
  20.31 Is this ok [y/d/N]: Exiting on user command
  20.31 Your transaction was saved, rerun it with:
  20.31  yum load-transaction /tmp/yumsavetx.2024-06-01.12-26.2FgboK.yumtx
  Dockerfile:5
  3 |
     4 |     # 安装openssl
     5 | >>> RUN yum install openssl
     6 |
     7 |     # 安装必要的依赖
  ERROR: failed to solve: process "/bin/sh -c yum install openssl" did not complete successfully: exit code: 1

解决方案

根据提供的错误信息,安装 OpenSSL 时出现了交互式提示,询问是否要继续安装。
Dockerfile 中的yum install openssl命令需要在非交互模式下运行,以避免等待用户输入。
通过在运行 yum install openssl 命令时添加 -y 标志来实现非交互式安装。

修改 Dockerfile 中的相应行如下:

RUN yum install -y openssl

这样,安装 OpenSSL 将自动确认,并且不会等待用户输入。
重新构建你的Docker镜像,应该就不会再出现这个错误了。

总结

一般,在dockerfile中用yum安装都会加上-y用于实现非交互式安装。这其实也是dockerfile和正常的交互式shell安装的不同之处。所以,大家在编写dockerfile使用yum安装时要注意加上-y来进行默认确定,确保安装正常。


看到这里的小伙伴,恭喜你又掌握了一个技能👊
希望大家能取得胜利,坚持就是胜利💪
我是寸铁!我们下期再见💕


往期好文💕

保姆级教程

【保姆级教程】Windows11下go-zero的etcd安装与初步使用

【保姆级教程】Windows11安装go-zero代码生成工具goctl、protoc、go-zero

【Go-Zero】手把手带你在goland中创建api文件并设置高亮


报错解决

【Go-Zero】Error: user.api 27:9 syntax error: expected ‘:‘ | ‘IDENT‘ | ‘INT‘, got ‘(‘ 报错解决方案及api路由注意事项

【Go-Zero】Error: only one service expected goctl一键转换生成rpc服务错误解决方案

【Go-Zero】【error】 failed to initialize database, got error Error 1045 (28000):报错解决方案

【Go-Zero】Error 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)报错解决方案

【Go-Zero】type mismatch for field “Auth.AccessSecret“, expect “string“, actual “number“报错解决方案

【Go-Zero】Error: user.api 30:2 syntax error: expected ‘)‘ | ‘KEY‘, got ‘IDENT‘报错解决方案

【Go-Zero】Windows启动rpc服务报错panic:context deadline exceeded解决方案


Go面试向

【Go面试向】defer与time.sleep初探

【Go面试向】defer与return的执行顺序初探

【Go面试向】Go程序的执行顺序

【Go面试向】rune和byte类型的认识与使用

【Go面试向】实现map稳定的有序遍历的方式

GitHub 加速计划 / ope / openssl
20
1
下载
传输层安全性/安全套接层及其加密库
最近提交(Master分支:3 个月前 )
5b94140b Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/26462) 19 小时前
1dafff06 When a requested parameter has a non-NULL result pointer, and the error isn't simply that the result buffer is too small, don't return a non-zero result size. Returning a non-zero result size that isn't larger than the user's provided space is an indication that a result of that size was actually written, inviting trouble if the error indication was inadvertenly lost. Also, in such cases (wrong type, data can't be converted to the requested type when otherwise supported, ...) there is nothing useful to be done with the return size value, it can't help to address the problem. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <ppzgs1@gmail.com> (Merged from https://github.com/openssl/openssl/pull/26436) 19 小时前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐