dockerfile二进制构建JDK

IT
IT
IT
335
文章
1
评论
2020年3月23日18:05:48 评论 1,203 1073字阅读3分34秒

下载好二进制文件到本地,并解压。

dockerfile二进制构建JDK

[xiao@bgt-service dockerfile]$ ll
total 185296
-rw-r--r-- 1 root root       557 Jan  6 20:28 Dockerfile
drwxr-xr-x 8   10  143       255 Sep  6  2017 jdk1.8.0_151
-rw------- 1 root root 189736377 Jan  6 19:55 jdk-8u151-linux-x64.tar.gz

下载好镜像

[xiaoxin@bgt-service dockerfile]$ sudo docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
centos               centos7.4.1708      9f266d35e02c        9 months ago        197MB

编写dockerfile

[xiao@bgt-service dockerfile]$ vim Dockerfile
# CentOS7.4 with JDK 1.8.0
# build a new image with basic  centos
FROM centos:centos7.4.1708
# make a new directory to store the jdk files
RUN mkdir /usr/local/java
#copy the jdk  archive to the image,and it will automaticlly unzip the tar file
ADD jdk1.8.0_151 /usr/local/java
# set environment variables
ENV JAVA_HOME=/usr/local/java/
ENV JAVA_BIN=/usr/local/java/bin
ENV JRE_HOME=/usr/local/java/jre
ENV PATH=$PATH:/usr/local/java/bin:/usr/local/java/jre/bin
ENV CLASSPATH=/usr/local/java/jre/lib:/usr/local/java/lib:/usr/local/java/jre/lib/charsets.jar

构建

[xiao@bgt-service dockerfile]$ sudo docker build -t="centos-jdk24" .

查看镜像

[xiao@bgt-service dockerfile]$  sudo docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
centos-jdk24         latest              e5c7f76d445f        13 minutes ago      581MB
继续阅读
  • 我的QQ
  • QQ扫一扫
  • weinxin
  • 我的头条
  • 头条扫一扫
  • weinxin
Docker 最后更新:2020-3-27
IT
  • 本文由 发表于 2020年3月23日18:05:48
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
Docker部署Apollo Apollo

Docker部署Apollo

安装docker $ cd /opt/ $ sudo git clone --depth=1 https://github.com/cncentoscn/setuptools.git $ cd set...
Docker安装redis Docker

Docker安装redis

下载镜像 # docker pull redis 创建目录 # mkdir -p /home/redis/data # mkdir -p /home/redis/config 从 Redis 官方下载...
Centos8.1安装docker Docker

Centos8.1安装docker

yum方式安装 安装依赖 # yum install -y yum-utils device-mapper-persistent-data lvm2 添加仓库 # yum-config-manager...