Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.7K
Views
Archivo oculto .env no copiado usando Docker COPY

Tengo un Dockerfile y hay una sintaxis como esta COPY ["Gemfile", "Gemfile.lock", "Procfile", ".env", "/huginn/"]

Uso RUN /bin/bash -l -c "ls -a" para verificar el estado de la copia del archivo, encuentro que el archivo .env no se copia en la imagen.

Cambio el nombre del archivo .env a test.env y uso COPY ["Gemfile", "Gemfile.lock", "Procfile", "test.env", "/huginn/"] , luego funciona, test.env es copiado a la imagen.

Alguien sabe porque es? ¿Y alguna solución puede permitir que Docker admita el nombre de archivo COPY .env?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Si tiene un archivo .dockerignore , es posible que haya agregado para ignorar archivos ocultos como .git , .vagrant , etc.

Si .dockerfile ignora los archivos ocultos, puede habilitar para no ignorar o cambiar el nombre del archivo.

Para obtener más información sobre el archivo .dockerignore

over 4 years ago · Santiago Trujillo Report

0

Hay una declaración en la documentación del archivo .dockerignore :

 Note: For historical reasons, the pattern . is ignored.
over 4 years ago · Santiago Trujillo Report

0

compartir mi dockerfile, puede funcionar correctamente ahora

 FROM ruby:2.3 MAINTAINER Tomato <tsaohucn@gmail.com> ENV DEBIAN_FRONTEND noninteractive ENV LANG C.UTF-8 ENV RAILS_VERSION 5.0.1 # install rails && bundler RUN gem install rails --version "$RAILS_VERSION" WORKDIR /huginn # copy huginn config file COPY ["Gemfile", "Gemfile.lock", "Procfile", ".env", "/huginn/"] COPY lib/gemfile_helper.rb /huginn/lib/ COPY vendor/gems /huginn/vendor/gems # run bundle install RUN bundle install # copy huginn COPY . /huginn/ RUN ls -a

Y hay un .dockerignore:

 .git tmp log doc spec media .openshift .bundle vendor/bundle db/*.sqlite3 public/system/* coverage .travis.yml build_docker_image.sh # Copied from .gitignore *.rbc *.sassc .sass-cache capybara-*.html .rspec !/tmp/.gitkeep **.orig rerun.txt pickle-email-*.html .idea/ .DS_Store deployment/tmp deployment/cookbooks .vagrant .*un~ .ruby-gemset .ruby-version manifest.yml config/unicorn.rb db/schema.rb
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!