---
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在同一目录下
