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

349
Visualizações
Why can't docker build COPY files to the /dev folder?

I want to create a docker image where I add a file to the /dev folder. I'm using this Dockerfile:

FROM ubuntu:bionic
COPY test.txt /dev/

After building this with:

docker build -t test .

I get a docker image where nothing has been added to the /dev folder. No error has been thrown by docker build.

I find this very strange because copying to different folders works fine. For example

  • COPY test.txt /
  • COPY test.txt /root/
  • COPY test.txt /home/

all work fine.

Does the /dev folder have some special permissions? How do I copy a file to the /dev folder?

I'm using Docker Toolbox on windows.

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

0

/dev is a special folder on linux systems reserved to maintain the devices related ressources (filesystem, disks, etc...) and mounted on a special filesystem. In a docker container, it will be remounted with a tmpfs dedicated filesystem and is not on the main container filesystem (/). See the following example:

$ docker run -it --rm ubuntu:18.04
root@17b9ad96ccbc:/# df -h /dev/
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            64M     0   64M   0% /dev

In your case, your file was actually copied during the build but in a temporary filesystem that died as soon as the build was finished.

Conclusion: don't use /dev as a destination, choose an other folder.

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