Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

519
Visualizações
Using fabric8 docker-maven-plugin to build images on a remote docker daemon

I'm attempting to use fabric8's docker-maven-plugin to build docker images within my gitlab ci pipeline.

Background:

My image build stage in gitlab-ci.yml looks like:

build_image:
  stage: build
  image: $JAVA_IMAGE
  services:
    - name: docker:dind
      alias: docker-build
  script:
    - ./mvnw docker:build
  allow_failure: true
  except: *nobuild
  tags:
    - autoscaler

My pom has

<plugin>
    <groupId>io.fabric8</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>0.30.0</version>
    <configuration>
        <!-- the hostname should be the same as the service alias specified in the gitlab ci file-->
        <dockerHost>tcp://docker-build:2375</dockerHost>
        <images>
            <image>
                <name>my-image</name>
                <build>
                    <contextDir>${project.basedir}/path/where/Dockerfile/lives</contextDir>
                    <filter>false</filter>
                    <tags>
                        <tag>latest</tag>
                        <tag>${project.version}</tag>
                    </tags>
                </build>
            </image>
        </images>
    </configuration>
</plugin>

And my Dockerfile contains

COPY ./some/directory/ /destination/path/within/image

But the build fails with the error

41014 [ERROR] DOCKER> Unable to build image [my-image] : "COPY failed: stat /var/lib/docker/tmp/docker-builder785340074/some/directory/: no such file or directory"  ["COPY failed: stat /var/lib/docker/tmp/docker-builder785340074/some/directory/: no such file or directory" ]

Question:

The problem seems to be that maven, within the container built from $JAVA_IMAGE, is using the docker:dind container's docker daemon (at tcp://docker-build:2375) to build my-image (as intended), but the docker:dind container does not have access to the files on the $JAVA_IMAGE container at ./some/directory/. Is there a way to give it access to those files, or to copy those files onto the docker:dind container? Or is there a better way to do what I'm trying to do (while maintaining the separation between the service image docker:dind and the build image $JAVA_IMAGE)?

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda