码头工人:“ lstat没有这样的文件或目录”;建立图片时发生错误。文件在那里 [英] Docker: "lstat no such file or directory" error when building image. File is there

查看:70
本文介绍了码头工人:“ lstat没有这样的文件或目录”;建立图片时发生错误。文件在那里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个简单的JS Boilerplate部署到Docker Cloud。我使用的Dockerfile已经用于其他样板和映像。 Dockerfile非常简单。它只是基于官方的nginx,添加了两个配置文件,然后将我的gulp样板的输出文件夹添加到了nginx根目录。所以我将它从一个目录复制到新的样板,因为我想尝试这个。

I want to deploy a simple JS Boilerplate to Docker Cloud. I use a Dockerfile that I already used for a different Boilerplate and image. The Dockerfile is pretty simple. It is just based on the official nginx, adds two config files and then the output folder of my gulp boilerplate to the nginx root. So I copied it from the one directory to the new boilerplate since I want to try this one.

我得到的错误是(最后一行)

The error I'm getting is this (last line)

Sending build context to Docker daemon 277.5 kB
Step 1 : FROM nginx
 ---> af4b3d7d5401
Step 2 : MAINTAINER Ole Bjarnstroem
 ---> Using cache
 ---> f57bc23d9444
Step 3 : ENV LANG en_US.UTF-8
 ---> Using cache
 ---> f6f4a76092dd
Step 4 : COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
 ---> Using cache
 ---> c4f83a39ba73
Step 5 : COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
 ---> Using cache
 ---> 6fe5a6b61d9f
Step 6 : ADD ./dist /usr/share/nginx/html
lstat dist: no such file or directory

但是dist文件夹在那里。

But the dist folder is there.

.
├── Dockerfile
├── JSCS.intellij.formatter.xml
├── README.md
├── app
├── dist
├── gulpfile.babel.js
├── jspm.conf.js
├── jspm_packages
├── karma.conf.js
├── nginx
├── node_modules
├── package.json
├── tsconfig.json
├── tslint.json
├── typings
└── typings.json

值得一提的是,要复制的文件夹称为 ./ public 所以我可以想象这是某种奇怪的Docker Cache问题。

It might be noteworthy that the folder to be copied was called ./public So I could imagine that this is some kind of weird Docker Cache issue.

我的Dockerfile:

My Dockerfile:

FROM nginx

ENV LANG en_US.UTF-8

# Copy configuration files
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf

# Add Gulp output folder to server root
ADD ./dist /usr/share/nginx/html

# Port configuration
EXPOSE 8080

到目前为止,我尝试过的操作:

What I tried so far:


  • 删除悬空和未使用的映像

  • 删除同一docker文件之前产生的映像

  • 使用其他标签

我的构建命令:

docker build -t my_repo/my_app .

感谢您的帮助!

编辑:其他所有文件夹都可以使用。这也不是文件权限的问题。似乎Docker 不喜欢dist文件夹。真烂

Every other folder works. It is also not a problem of file permissions. It seems, that Docker just doesn't like the dist folder. Which sucks.

推荐答案

嗯,我很愚蠢。项目文件夹中有一个 .dockerignore 文件,其中 dist ...案例关闭

Well, stupid me. There was a .dockerignore file with dist in the project folder... Case closed

这篇关于码头工人:“ lstat没有这样的文件或目录”;建立图片时发生错误。文件在那里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆