运行容器
前置条件 本机安装好Docker 23.0.1版本
下载离线安装包 https://download.docker.com/linux/static/stable/x86_64/docker-23.0.1.tgz
解压到/opt/jenkins/tools/docker目录
docker run --restart=always --name=jenkins -p 8080:8080 -p 50000:50000 -d -v /opt/jenkins:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -u 0 jenkins/jenkins:lts
进入容器内部 docker exec -it jenkins sh
执行
echo $PATH
ln -s /var/jenkins_home/tools/docker/docker /usr/local/bin/docker
建个测试工程
+ java -version
java version "11.0.16.1" 2022-08-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.16.1+1-LTS-1)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.16.1+1-LTS-1, mixed mode)
+ gradle -v
------------------------------------------------------------
Gradle 7.5
------------------------------------------------------------
Build time: 2022-07-14 12:48:15 UTC
Revision: c7db7b958189ad2b0c1472b6fe663e6d654a5103
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.16.1 (Oracle Corporation 11.0.16.1+1-LTS-1)
OS: Linux 4.18.0-425.13.1.el8_7.x86_64 amd64
+ node -v
v18.15.0
+ docker info
Client:
Context: default
Debug Mode: false
Server:
Containers: 12
Running: 12
Paused: 0
Stopped: 0
Images: 22
Server Version: 23.0.1
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 2456e983eb9e37e47538f59ea18f2043c9a73640
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
seccomp
Profile: builtin
Kernel Version: 4.18.0-425.13.1.el8_7.x86_64
Operating System: Rocky Linux 8.7 (Green Obsidian)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 31.21GiB
Name: k3s-infra-01
ID: bb1affd6-5524-48a7-9a2a-cb392a90510a
Docker Root Dir: /opt/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
192.168.1.48:5000
127.0.0.0/8
Registry Mirrors:
https://b9pmyelo.mirror.aliyuncs.com/
Live Restore Enabled: false
WARNING: API is accessible on http://0.0.0.0:2375 without encryption.
Access to the remote API is equivalent to root access on the host. Refer
to the 'Docker daemon attack surface' section in the documentation for
more information: https://docs.docker.com/go/attack-surface/
Finished: SUCCESS
出现docker info内容表示成功
测试运行环境这Rocky Linux 8.7 (Green Obsidian) 4C32G 400G(SSD)