1. Configuring the Environment
New Execstart=/usr/bin/dockerd-h tcp://0.0.0.0:2375-h Unix://var/run/docker.sock
[Email protected]:~# nano/lib/systemd/system/docker.service
[Email protected]:~# cat/lib/systemd/system/docker.service
[Unit]
Description=docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target Docker.socket Firewalld.service
Wants=network-online.target
Requires=docker.socket
[Service]
Type=notify
# The default is not-use SYSTEMD for cgroups because the delegate issues still
# exists and SYSTEMD currently does not support the Cgroup feature set required
# for containers run by Docker
Execstart=/usr/bin/dockerd-h tcp://0.0.0.0:2375-h Unix://var/run/docker.sock
Execreload=/bin/kill-s HUP $MAINPID
limitnofile=1048576
# have Non-zero limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
Limitnproc=infinity
Limitcore=infinity
# uncomment Tasksmax If your SYSTEMD version supports it.
# only SYSTEMD 226 and above support this version.
Tasksmax=infinity
Timeoutstartsec=0
# Set delegate yes so, SYSTEMD does not reset the cgroups of Docker containers
Delegate=yes
# kill only the Docker process, not all processes in the Cgroup
Killmode=process
# Restart the Docker process if it exits prematurely
Restart=on-failure
Startlimitburst=3
startlimitinterval=60s
[Install]
Wantedby=multi-user.target
Restart Docker
[Email protected]:~# service Docker Reload
Warning:docker.service changed on disk. Run ' Systemctl daemon-reload ' to reload units.
[Email protected]:~# systemctl daemon-reload
[Email protected]:~# systemctl Docker restart
Unknown Operation Docker.
[Email protected]:~# service Docker restart
Detecting the configured ports
[Email protected]:~# netstat-antp | grep 2375
TCP6 0 0::: 2375:::* LISTEN 19143/dockerd
2. Java Access client
Loading the Docker-java jar
<!--Https://mvnrepository.com/artifact/com.github.docker-java/docker-java--
<dependency>
<groupid>com.github.docker-java</groupId>
<artifactid>docker-java</artifactId>
<version>3.0.14</version>
</dependency>
Initializing Client Access
Dockerclient dockerclient = dockerclientbuilder.getinstance (). build ();
Java access to Docker environments