相关推荐recommended
docker重建镜像
作者:mmseoamin日期:2024-02-05

DockerFile如下:

FROM k8s-registry.qhtx.local/base/centos7-jdk8-haitong0704
RUN yum -y update && yum install -y python3-devel && yum install -y python36
RUN mv /usr/bin/python /usr/bin/python_old
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN pip3 install cx_Oracle -i https://pypi.doubanio.com/simple
RUN pip3 install pymysql  -i https://pypi.doubanio.com/simple
RUN mkdir -p /opt/oracle \
&& cd /opt/oracle \
&& unzip instantclient-basic-linux.x64-11.2.0.4.0.zip \
&& sh -c "echo /opt/oracle/instantclient_11_2 > /etc/ld.so.conf.d/oracle-instantclient.conf" \
&& ldconfig
COPY  ./oracleFile/*  /usr/local/lib64/python3.6/site-packages/

配置: cx_Oracle 

Instant Client for Linux x86-64 (64-bit)
yum install libaio
mkdir -p /opt/oracle
cd /opt/oracle
unzip instantclient-basic-linux.x64-11.2.0.4.0.zip
sh -c "echo /opt/oracle/instantclient_11_2 > /etc/ld.so.conf.d/oracle-instantclient.conf"
ldconfig
#!/bin/bash
rm -rf ./Dockerfile
read -p "Enter your project " project
read -p "select from k8s-registry.qhtx.local/base/centos7-jdk8-haitong0704 alpine-server-jre8u241" from
typeset -l  sproject
sproject=$project
cat<>Dockerfile
FROM $from
WORKDIR /apply/integrator
RUN rm -f /etc/localtime \
&& ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone
ADD $project.jar /apply/integrator/$project.jar
ENTRYPOINT java -XX:MaxRAMPercentage=80.0 -jar $project.jar --spring.profiles.active=prod
EOF
a=$(echo $RANDOM)
docker build -t k8s-registry.qhtx.local/haitong/$sproject:$a .
docker push  k8s-registry.qhtx.local/haitong/$sproject:$a
echo k8s-registry.qhtx.local/haitong/$sproject:$a

docker重建镜像,第1张

创建容器并进入

docker run -it  centos:latest  /bin/bash  

后台创建容器

docker run -itd  centos:latest  /bin/bash  

docker run -id --name=jinxcentos  -v  /home/jinx/:/home/  centos:7