默认配置的
JAVA_HOST=/opt/java & PATH=$JAVA_HOST/bin 两个环境变量注意: 启动容器时, 需要挂载外部 JDK目录, 方可使用
docker run --rm -v /opt/containerd/java/:/opt/java/ striveonger/ubuntu:22.04 /bin/bash -c "date & java --version"
结果:
Unable to find image 'striveonger/ubuntu:22.04' locally
22.04: Pulling from striveonger/ubuntu
6edbc812af48: Already exists
c3cab50f1d94: Pull complete
2fd56098f969: Pull complete
Digest: sha256:dae46fb6709d85da3ad4da864351ab94fde0c7b0d2c5b967da2a0cb5879992a3
Status: Downloaded newer image for striveonger/ubuntu:22.04
Wed Apr 22 13:01:47 CST 2026
java 21.0.10 2026-01-20 LTS
Java(TM) SE Runtime Environment (build 21.0.10+8-LTS-217)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.10+8-LTS-217, mixed mode, sharing)
Content type
Image
Digest
sha256:42424316e…
Size
28.4 MB
Last updated
5 months ago
docker pull striveonger/ubuntu:22.04