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

1.8K
Visualizações
Hidden file .env not copied using Docker COPY

I have a Dockerfile and there is a syntax like this COPY ["Gemfile", "Gemfile.lock", "Procfile", ".env", "/huginn/"]

I use RUN /bin/bash -l -c "ls -a" to check file cope status, I find .env file doen't be copied to the image.

I change the .env file name to test.env and use COPY ["Gemfile", "Gemfile.lock", "Procfile", "test.env", "/huginn/"], then it work, test.env is copied to the image.

Anyone know why is? And any solution can let docker support COPY .env file name?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

If you have .dockerignore file then it might be you added to ignore hidden files like .git, .vagrant etc.

If .dockerfile ignoring hidden files then either you can enable to not ignore or change file name.

For more info about .dockerignore file

over 4 years ago · Santiago Trujillo Relatório

0

There is a statement in .dockerignore file documentation:

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

0

share my dockerfile, it can work correctly now

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

And there is a .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 Relatório
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