• 小知识:Docker环境缺少vi命令,如何解决


    docker exec可以使用--user参数指定root用户,进入安装vi即可:

    [opc@oci-001 ~]$ docker exec -it --user root testdb bash
    bash-4.2# vi
    bash: vi: command not found
    bash-4.2# yum install vi
    Loaded plugins: ovl
    ol7_UEKR5                                                                                                                                                    | 3.0 kB  00:00:00
    ol7_latest                                                                                                                                                   | 3.6 kB  00:00:00
    (1/5): ol7_UEKR5/x86_64/updateinfo                                                                                                                           | 186 kB  00:00:00
    (2/5): ol7_latest/x86_64/group_gz                                                                                                                            | 136 kB  00:00:00
    (3/5): ol7_latest/x86_64/updateinfo                                                                                                                          | 3.4 MB  00:00:00
    (4/5): ol7_UEKR5/x86_64/primary_db                                                                                                                           |  34 MB  00:00:01
    (5/5): ol7_latest/x86_64/primary_db                                                                                                                          |  37 MB  00:00:01
    Resolving Dependencies
    --> Running transaction check
    ---> Package vim-minimal.x86_64 2:7.4.629-8.0.1.el7_9 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================================================================================================
     Package                                   Arch                                 Version                                              Repository                                Size
    ====================================================================================================================================================================================
    Installing:
     vim-minimal                               x86_64                               2:7.4.629-8.0.1.el7_9                                ol7_latest                               443 k
    
    Transaction Summary
    ====================================================================================================================================================================================
    Install  1 Package
    
    Total download size: 443 k
    Installed size: 914 k
    Is this ok [y/d/N]: y
    Downloading packages:
    vim-minimal-7.4.629-8.0.1.el7_9.x86_64.rpm                                                                                                                   | 443 kB  00:00:00
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : 2:vim-minimal-7.4.629-8.0.1.el7_9.x86_64                                                                                                                         1/1
      Verifying  : 2:vim-minimal-7.4.629-8.0.1.el7_9.x86_64                                                                                                                         1/1
    
    Installed:
      vim-minimal.x86_64 2:7.4.629-8.0.1.el7_9
    
    Complete!
    bash-4.2# vi
    bash-4.2#
    
    AlfredZhao©版权所有「从Oracle起航,领略精彩的IT技术。」
  • 相关阅读:
    protocol buffer
    一个数组中只有0,1,2三种元素,要求对这样的数组进行排序
    初见-TensorRT简介<转>
    如何制作python安装模块(setup.py)
    Reservoir Sampling
    Tensorflow 之 name/variable_scope 变量管理
    Tensorflow之调试(Debug) && tf.py_func()
    python with和上下文管理工具
    hello--GAN
    metronic后台模板学习 -- 所用外部插件列表
  • 原文地址:https://www.cnblogs.com/jyzhao/p/15616535.html
Copyright © 2020-2023  润新知