Installing plugins
Docker plugin, first need to install the Docker plugin in your idea, navigate to file-setting-plugins and search for Docker integration installation
Configure the Docker server to locate File-setting-build,execution,deployment-docker in idea
Run the idea project onto a remote Linux docker
Writing Dockerfile files
Add maven Dependency
<build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactid>spring-boot-maven-plugin</ Artifactid> </plugin> <!--using Docker-maven-plugin plugins--<plugin> <gro Upid>com.spotify</groupid> <artifactId>docker-maven-plugin</artifactId> <ver Sion>1.0.0</version> <!--bind the plug-in to a phase--<executions> <exe Cution> <id>build-image</id> <!--bind the plugin to the package phase. That is, the user simply executes the MVN package and automatically executes MVN docker:build--> <phase>package</phase> <goals> <goal>build</goal> </goals> & Lt;/execution> </eXecutions> <configuration> <!--Specify the generated image name--<IMAGENAME>ZHANGJ ianbin1991/${project.artifactid}</imagename> <!--Assign Labels--<imageTags> <imageTag>latest</imageTag> </imageTags> <!--designation Dockerfi Le path-<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> <!--specify remote Docker API address--<dockerHost>http://192.168.75.132:2375</dockerHost> <!--here is the copy jar package to the Docker container specified directory configuration-<resources> <resource> <targetPath>/</targetPath> <!--the path where the jar package is located the corresponding target directory is configured here-- > <directory>${project.build.directory}</directory> <!--required The jar package to include, which corresponds to the DockerFileName added in file-<include>${project.build.finalName}.jar</include> </resource> </resources> </configuration> </plugin> </plug Ins></build>
MVN Packaging
How to access the Docker REST API remotely
Docker remote API refers to the Docker team in order to remotely manage Docker, allow the operation of Docker daemon through the UNIX socket communication, we can also call its rest API through HTTP, complete the container query, create, destroy and so on.
Open Docker ports, the following approach is done with CENTOS7:
···
Vi/etc/sysconfig/docker
Add the following fields:
Options= '--selinux-enabled-h unix://var/run/docker.sock-h tcp://0.0.0.0:2375 '
···
···
Restart Docker
Systemctl Daemon-reload
Systemctl Restart Docker
View Port Numbers
NETSTAT-NPLT |grep 2375
···
Get the current container information with Curl and HTTP for information about Docker containers
···
Curl Http://localhost:2375/containers/json
···
Access via HTTP
Idea Docker connects to Docker on Linux