Docker ------ Idea remote connection and generates image uploaded and

1.Docker open the Remote Access Connection

Remarks:

1) Linux version is CentOS7

2) Installation Docker may refer to:

https://www.cnblogs.com/tianhengblogs/p/12520226.html   

3) Edit the file docker.service

we /lib/systemd/system/docker.service

To modify ExecStart

/usr/bin/dockerd-current -H tcp://0.0.0.0:2375 -H unix://var/run/docke

Figure:

 

4) Restart Docker

systemctl daemon-reload

service docker restart

5) Test Dockers is on remote access

curl http://localhost:2375/version

6) open port 2375

--zone-cmd = Firewall public --add-Port = 2375 / tcp - Permanent Open # 2375 Port 

Firewall -cmd - reload # Configure take effect immediately 

Firewall -cmd --zone = public --list-View all the ports # port development

 

2.idea remote connection Docker

1) install the plug-Dockers

File - "Settings -" Plugins - "search -" Docker

 

 2) Add Dockerfile in the project directory

FROM openjdk:8-jdk-alpine
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

Figure:

 

 3) Modify the pom.xml file

<properties>
<docker.image.prefix>theng</docker.image.prefix>
</properties>
 
 
<build>
<!-- 项目打包名称 -->
<finalName>theng_config</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<configuration>
<repository>${docker.image.prefix}/${project.artifactId}</repository>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>

4) Add Docker boot configuration

Click on the small triangle - "Edit Configurations ...

 

 

 

5) Check the remote connection is successful Dockers

Remarks:

Docker in ip addr can view the network ip address

 

6) production using Maven jar package, the project directory / target will produce the jar package

 

 

 

 7) generating image Docker

 

 

 

 

3.Docker see the generated image

1) Edit docker.service

we /lib/systemd/system/docker.service

2) to modify ExecStart (Default after installation Docker)

/usr/bin/dockerd-current \

Figure:

 

 3) Restart Docker

systemctl daemon-reload

service docker restart

4) Check the generated image

docker images

Figure:

 

Guess you like

Origin www.cnblogs.com/tianhengblogs/p/12535887.html