首页 > 其他分享 >开源组件DockerFIle老是Build失败,如何解决

开源组件DockerFIle老是Build失败,如何解决

时间:2023-12-15 16:44:33浏览次数:26  
标签:-- jar jetty 开源 Build https datahub DockerFIle docker

推荐把外网地址替换为国内高速镜像

# 替换源地址
http://dl-cdn.alpinelinux.org/alpine   ===    https://mirrors.aliyun.com/alpine
https://repo1.maven.org/maven2   =====  https://maven.aliyun.com/repository/public
# go install 代理  proxy.golang.org
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
# yum镜像
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# docker镜像
https://hub.daocloud.io/
https://7iw3ne9w.mirror.aliyuncs.com/
http://hub-mirror.c.163.com/
# npm镜像
npm config set registry https://registry.npm.taobao.org
# yarn镜像
yarn config set registry https://registry.npm.taobao.org -g
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
# 设置APK加速 --repository ${ALPINE_REPO_URL}/edge/community/
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

Docker常用命令

# 停止所有的容器
docker stop $(docker ps -aq)
# 删除所有的容器
docker-compose rm --stop
# 删除所有的镜像
docker-compose down  --rmi all
# 删除容器
docker rm -f 容器名称
# 删除镜像
docker rmi 镜像ID
# docker镜像打包
docker save 镜像ID -o 包名.tar
# 下载镜像
docker pull 镜像名称:tag版本
# d导入镜像
docker load -i 包名.tar
# 镜像tag重命名
docker tag thatName:thatTag  thisName:thisTag
# 构建本地的镜像
docker build -t kafka-kafka:v1   -f Dockerfile ./
# 基本运行样式
docker run -d --name zookeeper -p 2181:2181 wurstmeister/zookeeper:tag
#查看容器日志(根据的容器名  --docker run —d  容器名)
docker logs <container name>
# 删除和停止容器
docker rm -f b7ee9987e6cb6881cad0e4bf09b9a7f9095003bbe5d67ff36fb2118b946478dd
# 创建docker通讯网络
docker network create datahub_network
# 指定运行脚本服务配置
docker-compose  -f docker-compose.yml up -d

示例

外网的开源项目:DockerFile


# Defining environment
ARG APP_ENV=prod

FROM golang:1-alpine3.18 AS binary

ENV DOCKERIZE_VERSION v0.6.1
WORKDIR /go/src/github.com/jwilder

RUN apk --no-cache --update add openssl git tar curl

WORKDIR /go/src/github.com/jwilder/dockerize

RUN go install github.com/jwilder/dockerize@$DOCKERIZE_VERSION

FROM alpine:3 AS base

# Upgrade Alpine and base packages
ENV JMX_VERSION=0.18.0
# PFP-260: Upgrade Sqlite to >=3.28.0-r0 to fix https://security.snyk.io/vuln/SNYK-ALPINE39-SQLITE-449762
RUN apk --no-cache --update-cache --available upgrade \
    && apk --no-cache add curl bash coreutils gcompat sqlite libc6-compat java-snappy \
    && apk --no-cache add openjdk11-jre-headless --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
    && curl -sS https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-runner/9.4.46.v20220331/jetty-runner-9.4.46.v20220331.jar --output jetty-runner.jar \
    && curl -sS https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-jmx/9.4.46.v20220331/jetty-jmx-9.4.46.v20220331.jar --output jetty-jmx.jar \
    && curl -sS https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/9.4.46.v20220331/jetty-util-9.4.46.v20220331.jar --output jetty-util.jar \
    && wget --no-verbose https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.24.0/opentelemetry-javaagent.jar \
    && wget --no-verbose https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/${JMX_VERSION}/jmx_prometheus_javaagent-${JMX_VERSION}.jar -O jmx_prometheus_javaagent.jar \
    && cp /usr/lib/jvm/java-11-openjdk/jre/lib/security/cacerts /tmp/kafka.client.truststore.jks
COPY --from=binary /go/bin/dockerize /usr/local/bin

ENV LD_LIBRARY_PATH="/lib:/lib64"

FROM base as prod-install
COPY datahub-upgrade.jar /datahub/datahub-upgrade/bin/
COPY metadata-models/src/main/resources/entity-registry.yml /datahub/datahub-gms/resources/entity-registry.yml

FROM base as dev-install
# Dummy stage for development. Assumes code is built on your machine and mounted to this image.
# See this excellent thread https://github.com/docker/cli/issues/1134

FROM ${APP_ENV}-install as final

RUN addgroup -S datahub && adduser -S datahub -G datahub
USER datahub

ENTRYPOINT ["java", "-jar", "/datahub/datahub-upgrade/bin/datahub-upgrade.jar"]

修改镜像地址

# Defining environment
ARG APP_ENV=prod

# Defining custom repo urls for use in enterprise environments. Re-used between stages below.
ARG ALPINE_REPO_URL=https://mirrors.aliyun.com/alpine
ARG GITHUB_REPO_URL=https://github.com
ARG MAVEN_CENTRAL_REPO_URL=https://maven.aliyun.com/repository/public

FROM golang:1-alpine3.18 AS binary

# Re-declaring arg from above to make it available in this stage (will inherit default value)
ARG ALPINE_REPO_URL

ENV DOCKERIZE_VERSION v0.6.1
WORKDIR /go/src/github.com/jwilder

# Optionally set corporate mirror for apk
RUN if [ "${ALPINE_REPO_URL}" != "https://mirrors.aliyun.com/alpine" ] ; then sed -i "s#https://mirrors.aliyun.com/alpine#${ALPINE_REPO_URL}#g" /etc/apk/repositories ; fi

RUN apk --no-cache --update add openssl git tar curl

WORKDIR /go/src/github.com/jwilder/dockerize
# 设置代理
RUN go env -w GO111MODULE=on
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go install github.com/jwilder/dockerize@$DOCKERIZE_VERSION

FROM alpine:3.18 AS base

# Re-declaring args from above to make them available in this stage (will inherit default values)
ARG ALPINE_REPO_URL
ARG GITHUB_REPO_URL
ARG MAVEN_CENTRAL_REPO_URL

# Optionally set corporate mirror for apk
RUN if [ "${ALPINE_REPO_URL}" != "https://mirrors.aliyun.com/alpine" ] ; then sed -i "s#https://mirrors.aliyun.com/alpine#${ALPINE_REPO_URL}#g" /etc/apk/repositories ; fi

# 设置APK加速 --repository ${ALPINE_REPO_URL}/edge/community/
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

# Upgrade Alpine and base packages
ENV JMX_VERSION=0.18.0
# PFP-260: Upgrade Sqlite to >=3.28.0-r0 to fix https://security.snyk.io/vuln/SNYK-ALPINE39-SQLITE-449762
RUN apk --no-cache --update-cache --available upgrade \
    && apk --no-cache add curl bash coreutils gcompat sqlite libc6-compat java-snappy \
    && apk --no-cache add openjdk11-jre-headless  \
    && curl -sS ${MAVEN_CENTRAL_REPO_URL}/org/eclipse/jetty/jetty-runner/9.4.46.v20220331/jetty-runner-9.4.46.v20220331.jar --output jetty-runner.jar \
    && curl -sS ${MAVEN_CENTRAL_REPO_URL}/org/eclipse/jetty/jetty-jmx/9.4.46.v20220331/jetty-jmx-9.4.46.v20220331.jar --output jetty-jmx.jar \
    && curl -sS ${MAVEN_CENTRAL_REPO_URL}/org/eclipse/jetty/jetty-util/9.4.46.v20220331/jetty-util-9.4.46.v20220331.jar --output jetty-util.jar \
    && wget --no-verbose http://maven.cqcztech.cn/repository/maven-public/io/opentelemetry/javaagent/opentelemetry-javaagent/1.24.0/opentelemetry-javaagent-1.24.0.jar -O opentelemetry-javaagent.jar \
    && wget --no-verbose ${MAVEN_CENTRAL_REPO_URL}/io/prometheus/jmx/jmx_prometheus_javaagent/${JMX_VERSION}/jmx_prometheus_javaagent-${JMX_VERSION}.jar -O jmx_prometheus_javaagent.jar \
    && cp /usr/lib/jvm/java-11-openjdk/jre/lib/security/cacerts /tmp/kafka.client.truststore.jks
COPY --from=binary /go/bin/dockerize /usr/local/bin

ENV LD_LIBRARY_PATH="/lib:/lib64"

FROM base as prod-install
COPY datahub-upgrade.jar /datahub/datahub-upgrade/bin/
COPY metadata-models/src/main/resources/entity-registry.yml /datahub/datahub-gms/resources/entity-registry.yml

FROM base as dev-install
# Dummy stage for development. Assumes code is built on your machine and mounted to this image.
# See this excellent thread https://github.com/docker/cli/issues/1134

FROM ${APP_ENV}-install as final

RUN addgroup -S datahub && adduser -S datahub -G datahub
USER datahub

ENTRYPOINT ["java", "-jar", "/datahub/datahub-upgrade/bin/datahub-upgrade.jar"]


标签:--,jar,jetty,开源,Build,https,datahub,DockerFIle,docker
From: https://www.cnblogs.com/gtnotgod/p/17903661.html

相关文章

  • IM 开源介绍
    文章目录引言国内TeamTalk(★★★★☆)OpenIM(★★★★☆)WildfireChat(★★★★★)MobileIMSDKflamingoGoBelieveIO国外Mattermost(★★★☆☆)RocketChatTelegramDeltaChat服务端goimTerry-Ye/imcimgimOIMChatJ-IMAPPTSWeChatmotianhuo/wechatgsdios/GSD_WeiXin更新记录总结引言近些年开......
  • 用什么样的开源流程表单实现办公流程化?
    近日,有不少热心网友询问道:如果要实现流程化办公,让整个办公效率火速提升上来,可以用什么样的开源流程表单工具?大伙都知道,随着低代码开发平台的盛行,办公效率也得到很大的提升,它的核心表单制作工具也因其可视化设计、灵活易操作、简便好维护等优势特点,成为很多合作伙伴青睐的优势了。......
  • 大模型那么火,教你一键ModelArts玩转开源LlaMA大模型
     本文分享自华为云社区《大模型那么火,教你一键Modelarts玩转开源LlaMA(羊驼)大模型》,作者:码上开花_Lancer。近日,LlaMA(羊驼)这个大模型再次冲上热搜!LLaMA(LargeLanguageModelMetaAI),由MetaAI发布的一个开放且高效的大型基础语言模型,共有7B、13B、33B、65B(650亿)四种版本。......
  • 大模型那么火,教你一键Modelarts玩转开源LlaMA(羊驼)大模型
    本文分享自华为云社区《大模型那么火,教你一键Modelarts玩转开源LlaMA(羊驼)大模型》,作者:码上开花_Lancer。近日, LlaMA(羊驼)这个大模型再次冲上热搜!LLaMA(LargeLanguageModelMetaAI),由MetaAI发布的一个开放且高效的大型基础语言模型,共有7B、13B、33B、65B(650亿)四种版本......
  • C++(cmake-build-debug 和 cmake-build-release)
    cmake-build-debug和cmake-build-release是两个默认的构建目录名称,通常在使用CMake构建项目时生成。以下是它们的主要作用和区别:1.cmake-build-debug:这是一个用于调试构建的默认构建目录名称。在这个目录下,CMake会生成包含调试信息的可执行文件,以方便在调试器中进行调试......
  • 【异常】File encoding has not been set, using platform encoding UTF-8, i.e. buil
    From: https://www.cnblogs.com/duanxianyouyang/p/14679926.htmlFileencodinghasnotbeenset,usingplatformencodingUTF-8,i.e.buildisplatformdependent!Usingplatformencoding(UTF-8actually)tocopyfilteredresources,i.e.buildisplatformdepen......
  • 自主人工智能(开源版)分享
    主要内容GPT-Engineer(https://github.com/AntonOsika/gpt-engineer)Auto-GPT(https://github.com/Significant-Gravitas/AutoGPT)Agent-GPT(https://github.com/reworkd/AgentGPT)curl--location'http://172.20.90.121:2000/v1/chat/completions'\-H&qu......
  • 你相信光吗?开源一个能进行虚拟光渲交互的全志D1s智能家居中控
    本文所介绍产品demo是在立创开源平台的开源作品**《全志D1s智能家居中控虚拟光渲交互(86盒)》**,项目选用RISC-V核心的全志D1s作为主控进行开发,并通过家庭WIFI内网,实现设备间MQTT通信,与其它开源单片机控制项目进行充分联动,旨在推广类似客制化键盘概念到智能家居领域,尝试打破各大厂商......
  • 开源地图库OpenLayers的简单使用
    引言最近在学习可视化的东西,这让我想起了一些以前用过的图表库,其实我在日常做的大多是普通的需求,可视化方面应用的并不多,只是偶尔会因为个别特殊的需求,去借助一些图表库来实现图表的展示,这些普通的图表库,在使用上都大差不差,并没有什么太大的区别,但是某些特殊的图表库,比如地图库,在......
  • 推荐一个小而全的第三方登录开源组件
    大家好,我是Java陈序员。我们在企业开发中,常常需要实现登录功能,而有时候为了方便,就需要集成第三方平台的授权登录。如常见的微信登录、微博登录等,免去了用户注册步骤,提高了用户体验。为了业务考虑,我们有时候集成的不仅仅是一两个第三方平台,甚至更多。这就会大大的提高了工作量,那......