---
title: IDEA打包镜像
description: IDEA打包docker镜像
published: true
date: 2021-08-02T08:30:46.945Z
tags: docker
editor: markdown
dateCreated: 2021-08-02T07:36:23.276Z
---

# 允许远程访问

## 修改配置

```bash
$ vim /lib/systemd/system/docker.service
```

将如下内容

```properties
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
```

修改为

```properties
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H fd:// --containerd=/run/containerd/containerd.sock 
```

## 刷新配置

```bash
$ systemctl daemon-reload
```

## 重启docker服务

```bash
$ systemctl restart docker
```

## 查看结果

```bash
curl http://localhost:2375/version
```

## 开放防火墙

```bash
# 添加端口
$ firewall-cmd --add-port=2375/tcp --permanent
# 重启
$ firewall-cmd --reload
# 查看防火墙
$ firewall-cmd --list-all
```

# 项目根路径添加Dockerfile文件

```dockerfile
FROM openjdk:8u292-jre-buster
ARG JAR_FILE=/target/*.jar
COPY ${JAR_FILE} wg-gateway.jar
ENTRYPOINT ["java","-jar","-Dspring.profiles.active=prod","/wg-gateway.jar"]
```

# 设置IDEA的Docker

![图像2021-8-2_下午3.33.jpg](/图像2021-8-2_下午3.33.jpg)

![图像2021-8-2_下午3.34.jpg](/图像2021-8-2_下午3.34.jpg)

## 运行docker查看结果