Linux

Posted 记录每天

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux相关的知识,希望对你有一定的参考价值。

# file list 

[22:43:27 root@centos7 jdk]#tree
.
├── Dockerfile
├── jdk-8u291-linux-x64.tar.gz
└── profile

0 directories, 3 files


# download jdk packages from oracle
# copy centos7:/etc/profile , add below 4 lines

[22:46:35 root@centos7 jdk]#tail -5 profile
export JAVA_HOME=/usr/local/jdk
export TOMCAT_HOME=/apps/tomcat
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$TOMCAT_HOME/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar


# edit Dockerfile
[22:47:19 root@centos7 jdk]#cat Dockerfile 
FROM centos7-base:v2
LABEL maintainer="noise <root@noise.com>"
ADD jdk-8u291-linux-x64.tar.gz /usr/local/src
RUN ln -s /usr/local/src/jdk1.8.0_291 /usr/local/jdk
ADD profile /etc/profile
ENV JAVA_HOME /usr/local/jdk
ENV JRE_HOME $JAVA_HOME/jre
ENV CLASSPATH $JAVA_HOME/lib/:$JRE_HOME/lib/
ENV PATH $PATH:$JAVA_HOME/bin

# docker  build 
[22:41:06 root@centos7 jdk]#docker build -t jdk:v2.0 .

[22:41:15 root@centos7 jdk]#docker images
REPOSITORY                      TAG              IMAGE ID       CREATED          SIZE
jdk                             v2.0             e1ef0c699afa   4 seconds ago    708MB

# docker run to check if jdk is installed successfully
[22:41:19 root@centos7 jdk]#docker run -it jdk:v2.0 bash
[root@344f5caf88ee /]# java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
[root@344f5caf88ee /]# exit
exit

# push to harbor
[22:41:43 root@centos7 jdk]#docker tag jdk:v2.0 10.0.0.101/example/jdk:v2.0

[22:42:43 root@centos7 jdk]#docker push 10.0.0.101/example/jdk:v2.0
The push refers to repository [10.0.0.101/example/jdk]
193267eb9d23: Pushed 
9f7b8adad2b1: Pushed 
496063d1b0f4: Pushed 
7b578e484e37: Pushed 
764e12176167: Pushed 
034f282942cd: Pushed 
v2.0: digest: sha256:b7b5863b67bbe0228da549df1b79d8c8a6be62627747d41f843d2e18b160a092 size: 1577

 

以上是关于Linux的主要内容,如果未能解决你的问题,请参考以下文章

linux打开终端如何启动scala,如何在终端下运行Scala代码片段?

Android 逆向Linux 文件权限 ( Linux 权限简介 | 系统权限 | 用户权限 | 匿名用户权限 | 读 | 写 | 执行 | 更改组 | 更改用户 | 粘滞 )(代码片段

linux中怎么查看mysql数据库版本

-bash: /usr/bin/ls: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory(代码片段

text Debian linux片段

markdown 我的linux片段为RHCSA