wiki-files/docker/springboot-image.md

37 lines
680 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 制作Springboot镜像
description: docker制作Springboot镜像
published: true
date: 2021-08-02T08:30:07.987Z
tags: docker
editor: markdown
dateCreated: 2021-08-02T07:28:27.593Z
---
# 制作Springboot镜像
## 系统打包
### 编写Dockerfile
```dockerfile
FROM openjdk:8u292-jre-buster
ARG JAR_FILE=*.jar
COPY ${JAR_FILE} gateway.jar
ENTRYPOINT ["java","-jar","-Dspring.profiles.active=prod","/gateway.jar"]
```
### 打包
```bash
$ docker build -t gateway-docker .
```
### 后台运行
```bash
$ docker run --name Gateway -p 9099:9999 --network service --network-alias gateway -d gateway-docker
```
注意打包时jar包与dockerfile在同一目录下