一、docker容器内不能使用vim

Solution:

以root进入Container内

docker exec -it -user root jenkins /bin/bash

更新软件包

apt-get update

升级过程可能非常慢,因为是从海外站点PullImage,所以我们可以Configuration一个国内的Image源,AccelerationImagePull更新。

Backup原File

mv /etc/apt/sources.list /etc/apt/sources.list.bak

ViewContainer中DebianVersion

cat /etc/issue

修改Configurationsources.listFile

根据自己Version修改成对应内容,修改内容参考阿里Imagehttps://developer.aliyun.com/mirror/debian

我ContainerDebian为11.xVersion,修改内容为:

deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib

重新Execute

apt-get update

Installationvim

apt-get install -y vim

Installationrpm

apt-get install rpm -y

二、docker容器内vim不能粘贴内容

vim右键进入visualPattern无法粘贴

Solution

vim /usr/share/vim/vim80/defaults.vim

修改内容:第70行,在mouse=a的=前面加个-,修改后如下:

if has('mouse')
set mouse-=a
endif

三、docker容器内环境配置

修改环境变量Configuration

vi /etc/profile

新增jdk、mavn环境变量Configuration

# java环境变量
export JAVA_HOME=/jdk/jdk-11.0.10
export JRE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=./:JAVA_HOME/lib:$JRE_HOME/lib

# maven环境变量
export M2_HOME=/maven/apache-maven-3.8.5
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin

重新加载环境变量

source /etc/profile

检验是否Configuration成功

java -version
mvn -v