- Mac下 Docker部署SpringBoot应用
- Docker与Dockerfile极简入门文档
-
Spring Boot with Docker
部署运行容器
docker run -d -p 主机端口:8080 --name 容器名称 镜像名称
进入容器内部
docker exec -it 容器名称 /bin/bash
查看容器信息
docker inspect 容器id或名称
查看容器的某一项具体细信息,如下面的查看容器的IP
docker inspect -f {{.NetworkSettings.IPAddress}} 容器id或名称
springboot里配置的Dockerfile
FROM openjdk:8-jdk-alpine
VOLUME /tmp
#ADD spring-boot-docker-1.0.jar app.jar
#ADD docker-0.0.1.jar app.jar
ADD *.jar app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
redis:
config set requirepass 密码
auth 密码
config get requirepass
本地登录:redis-cli
远程登录:redis-cli -h xxxx.xx.xxx.xx -p xxxx -a 密码
pom.xml配置
<!--参数配置-->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<docker.image.prefix>springboot</docker.image.prefix>
</properties>
<!--编译插件-->
<plugins>
<!--maven plugin-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--docker plugin-->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
网友评论