国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

IDEA部署Docker到WSL2的詳細(xì)過程

瀏覽:31日期:2024-07-13 11:38:15

本地環(huán)境 Windows10+WSL2(Ubuntu),需要大家在服務(wù)器安裝 Docker 之后,開啟遠(yuǎn)程訪問

sudo vi /etc/default/docker 修改配置

# 開啟遠(yuǎn)程訪問 -H tcp://0.0.0.0:2375# 開啟本地套接字訪問 -H unix:///var/run/docker.sockDOCKER_OPTS='-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock'

sudo service docker restart 重啟

Idea 安裝 Docker 插件后,設(shè)置填寫地址 tcp://192.168.50.28:2375 (自己的本機(jī) IP 地址),成功連接的話有 Connection Successful 提示

IDEA部署Docker到WSL2的詳細(xì)過程

Tools 選項(xiàng)配置,需要先安裝 Windows 版本 Docker,裝完把程序關(guān)掉,開機(jī)自啟關(guān)掉,因?yàn)槲也幌攵嚅_一個(gè)程序,Ubuntu 里已經(jīng)有 Docker 了,這里只是要用到 docker-compose.exe 在 Windows 環(huán)境做下容器編排而已。Docker Machine 用不著的話不用管。

IDEA部署Docker到WSL2的詳細(xì)過程

一般的 Dockerfile 文件和 docker-compose.yml 文件參考

FROM ubuntu:latestCOPY target/*.jar /app.jarENV JAVA_HOME='/usr/lib/jdk1.8'ENV PATH='${PATH}:${JAVA_HOME}/bin:${JAVA_HOME}/sbin'ENTRYPOINT [ 'java', '-jar', '/app.jar' ]

version: ’3’services: last: build: context: . dockerfile: Dockerfile ports: - '18080:8080' volumes: - /usr/lib/jvm/java-8-openjdk-amd64:/usr/lib/jdk1.8 #宿主機(jī) jdk 映射給容器使用 tty: true network_mode: bridge restart: always

使用 Docker-compose 創(chuàng)建 Docker 容器

IDEA部署Docker到WSL2的詳細(xì)過程

Compose files 選擇剛創(chuàng)建的 docker-compose.yml 文件

運(yùn)行

Deploying ’Compose: lin-test’...'C:Program FilesDockerDockerresourcesbindocker-compose.exe' -f D:ProjectgitFilelinlin-testdocker-compose.yml up -dBuilding lastSending build context to Docker daemon 61.72MBStep 1/5 : FROM ubuntu:latest ---> c29284518f49Step 2/5 : COPY target/*.jar /app.jar ---> f13f1a3f4a0dStep 3/5 : ENV JAVA_HOME='/usr/lib/jdk1.8' ---> Running in ea05d01bf802Removing intermediate container ea05d01bf802 ---> 9bb4f1a6be38Step 4/5 : ENV PATH='${PATH}:${JAVA_HOME}/bin:${JAVA_HOME}/sbin' ---> Running in 73ab542794a5Removing intermediate container 73ab542794a5 ---> a6d791e7bd7cStep 5/5 : ENTRYPOINT [ 'java', '-jar', '/app.jar' ] ---> Running in e1704a59d50bRemoving intermediate container e1704a59d50b ---> 8ee7a6f5b53aSuccessfully built 8ee7a6f5b53aSuccessfully tagged lin-test_last:latestSECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have ’-rwxr-xr-x’ permissions. It is recommended to double check and reset permissions for sensitive files and directories.

Use ’docker scan’ to run Snyk tests against images to find vulnerabilities and learn how to fix themImage for service last was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.Creating lin-test_last_1 ... Creating lin-test_last_1 ... done’Compose: lin-test’ has been deployed successfully.

到此這篇關(guān)于IDEA 部署 Docker 到 WSL2的文章就介紹到這了,更多相關(guān)IDEA 部署 Docker WSL2內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: IDEA
相關(guān)文章:
主站蜘蛛池模板: 天镇县| 德州市| 商城县| 淮安市| 西丰县| 普定县| 全椒县| 广灵县| 区。| 开原市| 葵青区| 恩施市| 荆门市| 青神县| 桦川县| 新化县| 游戏| 海原县| 巧家县| 冕宁县| 台北市| 兰西县| 汾西县| 阳城县| 刚察县| 康平县| 乃东县| 广东省| 合肥市| 黄骅市| 姚安县| 金山区| 通州区| 翁源县| 阿尔山市| 广安市| 赤水市| 景宁| 汉阴县| 赣州市| 瓦房店市|