容器修改挂机目录
进入docker目录(需要ROOT权限)
修改config.v2.json文件
=="/usr/local/apache-maven-3.5.4":{"Source":"/usr/local/apache-maven-3.5.4","Destination":"/usr/local/apache-maven-3.5.4","RW":true,"Name":"","Driver":"","Type":"bind","Propagation":"rprivate","Spec":{"Type":"bind","Source":"/usr/local/apache-maven-3.5.4","Target":"/usr/local/apache-maven-3.5.4"},"SkipMountpointCreation":false}==,"/var/jenkins_home":{"Source":"/var/jenkins","Destination":"/var/jenkins_home","RW":true,"Name":"","Driver":"","Type":"bind","Propagation":"rprivate","Spec":{"Type":"bind","Source":"/var/jenkins","Target":"/var/jenkins_home"},"SkipMountpointCreation":false}},"SecretReferences":null,"ConfigReferences":null,"AppArmorProfile":"","HostnamePath":"/var/lib/docker/containers/dfabdb78cced8130a5e71b49fcc3cc02e4f18ff3f7467d3225a43a6878a919e3/hostname","HostsPath":"/var/lib/docker/containers/dfabdb78cced8130a5e71b49fcc3cc02e4f18ff3f7467d3225a43a6878a919e3/hosts","ShmPath":"/var/lib/docker/containers/dfabdb78cced8130a5e71b49fcc3cc02e4f18ff3f7467d3225a43a6878a919e3/mounts/shm","ResolvConfPath":"/var/lib/docker/containers/dfabdb78cced8130a5e71b49fcc3cc02e4f18ff3f7467d3225a43a6878a919e3/resolv.conf","SeccompProfile":"","NoNewPrivileges":false}
修改hostconfig.json文件
{"Binds":[=="/usr/local/apache-maven-3.5.4:/usr/local/apache-maven-3.5.4"==,"/var/jenkins:/var/jenkins_home","/etc/localtime:/etc/localtime"],"ContainerIDFile":"","LogConfig":{"Type":"json-file","Config":{}},"NetworkMode":"default","PortBindings":{"50000/tcp":[{"HostIp":"","HostPort":"50000"}],"8080/tcp":[{"HostIp":"","HostPort":"8081"}]},"RestartPolicy":{"Name":"no","MaximumRetryCount":0},"AutoRemove":false,"VolumeDriver":"","VolumesFrom":null,"CapAdd":null,"CapDrop":null,"Dns":[],"DnsOptions":[],"DnsSearch":[],"ExtraHosts":null,"GroupAdd":null,"IpcMode":"shareable","Cgroup":"","Links":null,"OomScoreAdj":0,"PidMode":"","Privileged":true,"PublishAllPorts":false,"ReadonlyRootfs":false,"SecurityOpt":["label=disable"],"UTSMode":"","UsernsMode":"","ShmSize":67108864,"Runtime":"runc","ConsoleSize":[0,0],"Isolation":"","CpuShares":0,"Memory":0,"NanoCpus":0,"CgroupParent":"","BlkioWeight":0,"BlkioWeightDevice":[],"BlkioDeviceReadBps":null,"BlkioDeviceWriteBps":null,"BlkioDeviceReadIOps":null,"BlkioDeviceWriteIOps":null,"CpuPeriod":0,"CpuQuota":0,"CpuRealtimePeriod":0,"CpuRealtimeRuntime":0,"CpusetCpus":"","CpusetMems":"","Devices":[],"DeviceCgroupRules":null,"DiskQuota":0,"KernelMemory":0,"MemoryReservation":0,"MemorySwap":0,"MemorySwappiness":null,"OomKillDisable":false,"PidsLimit":0,"Ulimits":null,"CpuCount":0,"CpuPercent":0,"IOMaximumIOps":0,"IOMaximumBandwidth":0,"MaskedPaths":null,"ReadonlyPaths":null}
重启docker服务
systemctl restart docker