Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

800
Vistas
.dockerignore fails to include files in subdirectories with !**/*.extension pattern

I'm having trouble with the .dockerignore file. This is my project structure:

file.sh
file.js
file.go
file.py
subdir/
    file2.go
    file2.py
.dockerignore
Dockerfile

According to the .dockerignore documentation:

(...) you may want to specify which files to include in the context, rather than which to exclude. To achieve this, specify * as the first pattern, followed by one or more ! exception patterns.

And:

Lines starting with ! (exclamation mark) can be used to make exceptions to exclusions.

Finally:

Docker also supports a special wildcard string ** that matches any number of directories (including zero). For example, **/*.go will exclude all files that end with .go that are found in all directories, including the root of the build context.

Based on that, this is my .dockerignore file:

# ignore everything
*

# whitelist
# ---------

# python files
!**/*.py

When I build and run the container and inspect the files, I get this:

file.py

The subdir directory is missing, subdir/file2.pyshould be included. It works if I add !subdir/**/.py to my .dockerignore, but the idea is to include any .py file in any subdirectory.

This is the file structure that should be present in the container:

file.py
subdir/
    file2.py

What's going on here?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I found a few issues that mention this exact problem, like these:

Exception patterns in .dockerignore do not support wildcard directories dockerignore does not respect the "special wildcard **" (comment)

And it seems like it's not gonna be fixed any time soon :(

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda