Installing vim in docker Container Troubleshooting

  • 2021-11-02 03:30:55
  • OfStack

The beginning of the catalog story
Install an vim edit hadoop-hive. env
Careless did not flash, it was actually debian
Other methods
Summarize

The beginning of the story

Many Internet companies must need refined management after their business has gone through 0-1 barbaric growth; Especially for your own users, you need to know your user characteristics/needs/just know how to make people happy like a love rat; People will follow you with all their heart.

If it is for enterprise users (to B), the problem is very simple: to visit different cooperative companies/industry leaders, everyone is purposeful, and it is clear that mutual benefit comes 1 to 2;

But users like us (to C), if randomly sampled users are invited to the company; Voucher survey; Not to mention once, is the sampled user data representative? Are the questions raised by users the current development direction of the team?

So the recent work in the original business analysis to add another layer: user tags. Mark the user behavior in your application, analysis of user characteristics, usage habits

Big data is needed in the intermediate process, so I choose to use docker to build an environment for my own test development, and I encounter a record of installing vim problems in the intermediate

Install an vim editor hadoop-hive. env

Installing an hive image using docker on centos 7


$ docker ps
CONTAINER ID   IMAGE                                                  COMMAND                  PORTS                                                      NAMES
dc387ff5c56d   bde2020/hive:2.1.0-postgresql-metastore                "entrypoint.sh /bin/ … "   0.0.0.0:10000->10000/tcp, 10002/tcp                        hive-server

$ docker exec -it dc387ff5c56d /bin/bash

# vim  Edit  hadoop-hive.env
/opt# vi hadoop-hive.env
bash: vi: command not found

#  It is understandable that mirror images pay attention to purity ,  Compile and install it 
/opt# yum install vim
bash: yum: command not found
/opt# rpm
bash: rpm: command not found

#  Or  curl  Be reliable 
/opt# wget http://yum.baseurl.org/download/3.2/yum-3.2.28.tar.gz
bash: wget: command not found
/opt# rz
bash: rz: command not found

/opt# curl
curl: try 'curl --help' or 'curl --manual' for more information
/opt# curl -o yum-3.2.28.tar.gz http://yum.baseurl.org/download/3.2/yum-3.2.28.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  864k  100  864k    0     0   276k      0  0:00:03  0:00:03 --:--:--  667k

#  You are too pure, aren't you? 
/opt# tar -zxvf yum-3.2.28.tar.gz
/opt/yum-3.2.28# ls
AUTHORS  ChangeLog  INSTALL   PLUGINS  TODO  callback.py  docs output.py  rpmUtils  test      yum  yum.spec yummain.py
COPYING  FAQ     Makefile  README   bin   cli.py   etc po    shell.py  utils.py  yum-updatesd.py yumcommands.py

/opt/yum-3.2.28# make
bash: make: command not found

At this time ~ bash: make: command ES50found huh? I don't even have an make compile command. Are containers playing so wild now

Careless did not flash, it was actually debian

No, will the image not be centos 7


#  View  linux  Kernel version 
/opt/yum-3.2.28# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
NAME="Debian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="http://bugs.debian.org/"

PRETTY_NAME= "Debian GNU/Linux 7 (wheezy)" Boy, it's debian. Let me check the apt-get installation command


/opt/yum-3.2.28# apt-get install vim
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: 

I knew it was not simple. Unable to locate ES80vim in China is usually because the apt-get source used by Debian needs to go over the wall abroad. It is good to configure domestic images


#  Will the original  `apt-get` Source file backup ,  Reconfiguration 
/# mv /etc/apt/sources.list /etc/apt/sources.list.bak
deb http://mirrors.163.com/debian/ jessie main non-free contrib
/opt/yum-3.2.28# echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list

/opt/yum-3.2.28# echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list

/opt/yum-3.2.28# echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list

/opt/yum-3.2.28# echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list

#  Update  apt-get,  Installation  vim
/opt/yum-3.2.28# apt-get update
/opt/yum-3.2.28# apt-get install vim

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libc6 vim-common vim-runtime
Suggested packages:
  glibc-doc locales ctags vim-doc vim-scripts
The following NEW packages will be installed:
  vim vim-common vim-runtime
The following packages will be upgraded:
  libc6
1 upgraded, 3 newly installed, 0 to remove and 179 not upgraded.
Need to get 10.8 MB of archives.
After this operation, 29.6 MB of additional disk space will be used.
Do you want to continue [Y/n]? y

Other methods

In addition, if it is only a simple configuration file replacement, you can also copy the hadoop-hive. env configuration file, docker cp hadoop-hive. env dc387ff5c5d:/opt to the folder specified in the container by editing it on the host machine.

Summarize

Installing docker image needs to pay attention to the system version kernel; Wrong version/version number and docker mismatch container problem


Related articles: