简体   繁体   English

Maven停止在Docker容器中进行下载

[英]Maven Hangs Downloading Inside a Docker Container

I have a gitlab with gitlab ci and a runner all running fine in a CoreOs Machine. 我有一个带有gitlab ci的gitlab和一个运行程序,它们在CoreOs机器上都运行良好。

All 3 services are running using the following dockerfiles service files and build script: 所有3个服务都使用以下dockerfiles服务文件和构建脚本运行:

Build Script: 构建脚本:

git submodule update --init

ls -la

mvn install

CI service: CI服务:

    [Unit]
    Description=CI

    # Requirements
    Requires=docker.service
    Requires=db.service
    Requires=gitlab.service
    Requires=redis.service


    # Dependency ordering
    After=docker.service
    After=db.service
    After=gitlab.service
    After=redis.service

    [Service]
    User=core

    # Let the process take awhile to start up (for first run Docker containers)
    TimeoutStartSec=0

    # Get CoreOS environmental variables
    EnvironmentFile=/etc/environment

    # Pre-start and Start
    ## Directives with "=-" are allowed to fail without consequence
    KillMode=none
    Restart=always
    RestartSec=2

    ExecStartPre=-/usr/bin/docker kill ci
    ExecStartPre=-/usr/bin/docker rm ci
    ExecStartPre=/usr/bin/docker pull sameersbn/gitlab-ci:5.2.0
    ExecStart=/usr/bin/docker run --name ci \
     -e 'DB_TYPE=mysql' -e 'DB_HOST=${COREOS_PRIVATE_IPV4}' -e 'DB_NAME=***' -e 'DB_USER=***' -e 'DB_PASS=********'\
     -e 'REDIS_HOST=${COREOS_PRIVATE_IPV4}' -e 'REDIS_PORT=6379'\
     -e 'GITLAB_URL=http://${COREOS_PRIVATE_IPV4}:8081/'\
     -e 'GITLAB_CI_HOST=${COREOS_PRIVATE_IPV4}'\
     -e 'GITLAB_CI_PORT=8080'\
     -e 'GITLAB_CI_HTTPS=true'\
     -e 'GITLAB_CI_EMAIL=*****************'\
     -e 'SMTP_USER=**********' -e 'SMTP_PASS=**********'\
     -p 8080:80 \
     sameersbn/gitlab-ci:5.2.0

    # Stop
    ExecStop=/usr/bin/docker stop ci

CI-runner service: CI运行器服务:

        [Unit]
        Description=CI Runner Maven & Dart

        # Requirements
        Requires=docker.service
        Requires=ci.service
        Requires=db.service
        Requires=gitlab.service
        Requires=redis.service

        # Dependency ordering
        After=docker.service
        After=ci.service
        After=db.service
        After=gitlab.service
        After=redis.service


        [Service]
        User=core

        # Let the process take awhile to start up (for first run Docker containers)
        TimeoutStartSec=0

        RemainAfterExit=yes

        # Get CoreOS environmental variables
        EnvironmentFile=/etc/environment

        #Pre-start and Start
        ## Directives with "=-" are allowed to fail without consequence

        ExecStartPre=-/usr/bin/docker kill ci-runner-maven-dart
        ExecStartPre=-/usr/bin/docker rm ci-runner-maven-dart
        ExecStartPre=/usr/bin/docker pull registry.globaleda.pt/globaleda/ci-runner-maven-dart:latest
        ExecStart=/usr/bin/docker run --name ci-runner-maven-dart -d \
            -v /data/ci-runner-maven-dart:/home/gitlab_ci_runner/data \
            registry.globaleda.pt/globaleda/ci-runner-maven-dart:latest

        # Stop
        ExecStop=/usr/bin/docker stop ci-runner-maven-dart

Ci runner dockerfile: CiRunner dockerfile:

FROM lemonbar/gitlab-runner-jdk-maven:1.0
MAINTAINER jrofurtado@gmail.com

RUN apt-get update
RUN apt-get install curl -y

# Install dartIn the dockerfile i added ENV MAVEN_OPTS -Djava.net.preferIPv4Stack=true

RUN apt-get install apt-transport-https -y
RUN sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
RUN sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
RUN apt-get update
RUN apt-get install dart -y
ENV DART_HOME /usr/lib/dart

RUN apt-get -y install ca-certificates curl
ADD globaleda.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates
RUN git config --global http.sslverify false 
RUN apt-get update
RUN curl -sSL https://get.docker.com/ubuntu/ | sudo sh
ENV DOCKER_HOST tcp://*************
ADD .dockercfg /
RUN rm -f /app/init
ADD init /app/
RUN chmod 777 /app/init

Ci dockerfile is unmodified version of sameersbn/gitlab-ci:5.2.0. Ci dockerfile是sameersbn / gitlab-ci:5.2.0的未修改版本。

when i compile a maven project (with mvn install) it starts to download the required artifacts and the download hangs, if i retry the download over and over again it manages to fully download problem is i need to download all at once without interruptions (it manages to continue cause im storing all the downloads on a mapped volume) 当我编译一个maven项目(使用mvn安装)时,它开始下载所需的工件,并且下载挂起,如果我一遍又一遍地重试下载,则它设法完全下载了问题,因为我需要一次下载所有文件而不会中断(它设法继续,因为我将所有下载存储在映射的卷上)

Observations: 观察:

-I deployed the Ci runner container on my local machine instead of the server and linked to the gitlab ci and the problem persists. -我在本地计算机而不是服务器上部署了CiRunner容器,并链接到gitlab ci,问题仍然存在。

-If you go inside the container (with docker-enter script or docker exec container bash) and run mvn install on a terminal it downloads everything as it should, although downloading it within the build it hangs. -如果您进入容器(使用docker-enter脚本或docker exec容器bash)并在终端上运行mvn install,它将下载所有内容,尽管它会在挂起的版本中下载。

-i tried using Setting MAVEN_OPTS to -Djava.net.preferIPv4Stack=true on dockerfile of CI-Runner,i also tried to include it in the build script of CI-Runner to force this variable: -i尝试在CI-Runner的dockerfile上使用将MAVEN_OPTS设置为-Djava.net.preferIPv4Stack = true,我还尝试将其包含在CI-Runner的构建脚本中以强制此变量:

  • In the dockerfile i added ENV MAVEN_OPTS -Djava.net.preferIPv4Stack=true 在dockerfile中,我添加了ENV MAVEN_OPTS -Djava.net.preferIPv4Stack = true
  • In the build script i added MAVEN_OPTS=-Djava.net.preferIPv4Stack=true 在构建脚本中,我添加了MAVEN_OPTS = -Djava.net.preferIPv4Stack = true

-Running in debug mode (-e) or reading the logs the only information i have is :Download Timeout -在调试模式(-e)中运行或读取日志,我仅有的唯一信息是:下载超时

UPDATE: Maven doesnt actually hangs, the build is completed successfully.But the runner doesnt communicate to the gitlab ci saying it made its work sucessfully due to a response error: 500. 更新:Maven实际上没有挂起,构建成功完成了,但是运行器没有与gitlab ci进行通信,称由于响应错误:500成功完成了工作。

>     2015-01-02 18:37:54 +0000 | Submitting build 439 to coordinator...response error: 500
>     2015-01-02 18:38:02 +0000 | Submitting build 439 to coordinator...response error: 500
>     2015-01-02 18:38:06 +0000 | Completed build 439, success.
>     2015-01-02 18:38:06 +0000 | Submitting build 439 to coordinator...response error: 500
>     2015-01-02 18:38:15 +0000 | Submitting build 439 to coordinator...response error: 500
>     2015-01-02 18:38:18 +0000 | Completed build 439, success.
>     2015-01-02 18:38:18 +0000 | Submitting build 439 to coordinator...response error: 500
>     2015-01-02 18:38:27 +0000 | Submitting build 439 to coordinator...response error: 500
>     2015-01-02 18:38:30 +0000 | Completed build 439, success.
>     2015-01-02 18:38:30 +0000 | Submitting build 439 to coordinator...response error: 500
>     2015-01-02 18:38:39 +0000 | Submitting build 439 to coordinator...response error: 500

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 docker 容器内运行 maven 集成测试 - Running maven integration test inside docker container 在 docker 容器内构建 maven 项目 - Build maven project inside docker container Docker容器内的Jenkinsfile Maven插件 - Jenkinsfile maven plugin inside a docker container docker 容器中的 Maven 忽略本地存储库 - Maven inside docker container ignoring local repository Docker –在docker容器中编译maven项目并从那里运行 - Docker – Compile maven project inside docker container & run it from there Maven 不要在 docker 容器内构建 *.jar。 为什么? - Maven don't build *.jar inside docker container. Why? 使用运行时参数在 Docker 容器内运行 Maven 项目 - Run Maven project inside Docker Container with run time parameters JUnit 5 tests are executed in parallel inside IntelliJ and locally with Maven, but not inside Maven Docker container on Google Cloud Build - JUnit 5 tests are executed in parallel inside IntelliJ and locally with Maven, but not inside Maven Docker container on Google Cloud Build Spring 启动 2 应用程序在 docker-maven-plugin 触发的 docker 容器内运行时无法连接到 mysql - Spring Boot 2 app cannot connect to mysql while run inside docker container triggered by docker-maven-plugin Maven JIB 在 arm32v7/adoptopenjdk docker 容器内返回“CertPathValidatorException:签名检查失败” - Maven JIB returns "CertPathValidatorException: signature check failed" inside arm32v7/adoptopenjdk docker container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM