docker build no such file or directory
在我构建新的镜像的时候, 发生 了 no such file or directory 的错误。 这个错误找了半天, 没头绪, 后来灵光一现, 原来是我的文件夹名字写错了
我的目录结构是这样的
[root@host sample]# find ./ -type f ./enginx/global.conf ./enginx/nginx.conf ./Dockerfile [root@host sample]# find ./ -type d ./ ./enginx [root@host sample]#
sample 文件夹中有一个Dockerfile 文件和一个nginx文件夹, nginx文件夹中有global.conf 和 nginx.conf
cd 进 sample 下 使用如下命令构建镜像
[root@host sample]# docker build -t addictions/nginx .
后面的“.” 表示当前目录, 会从当前目录去找Dockfile文件, 当前目录会被上传到docker进程作为构建上下文目录, 只有构建上下文目录的文件才可以被ADD 或者 COPY 到镜像中。
[root@host sample]# docker build -t addictions/nginx . Sending build context to Docker daemon 17.41 kB Sending build context to Docker daemon Step 0 : FROM ubuntu ---> 70d53b6cf65a Step 1 : MAINTAINER jxl "2013143154@qq.com" ---> Using cache ---> 0be2be8c6d47 Step 2 : ENV REFRESHED_AT 2018-10-21 ---> Using cache ---> 48ead1b5bfb6 Step 3 : RUN apt-get -yqq update && apt-get -yqq install nginx ---> Using cache ---> 3c834a6164b3 Step 4 : RUN mkdir -p /var/www/html/website ---> Using cache ---> 5044773f5e09 Step 5 : ADD nginx/global.conf /etc/nginx/conf.d/ nginx/global.conf: no such file or directory
以上是我报的错, 原因是我我在Dockerfie中的ADD 命令中的文件夹名字写成了nginx, 而构建上下文目录中的文件夹是enginx。 不一致, 所以在上下文目录中找不到这个文件夹, 自然也找不到文件夹下的目录
解决方案: 将构建上下文目录中的enginx 改成 nginx 即可, 或者将Dockerfile中的ADD 命令后面的nginx 改成enginx, 以下是构建成功之后的输出
[root@host sample]# docker build -t addictions/nginx . Sending build context to Docker daemon 4.608 kB Sending build context to Docker daemon Step 0 : FROM ubuntu---> 70d53b6cf65a Step 1 : MAINTAINER jxl "2013143154@qq.com"---> Using cache---> 0be2be8c6d47 Step 2 : ENV REFRESHED_AT 2018-10-21---> Using cache---> 48ead1b5bfb6 Step 3 : RUN apt-get -yqq update && apt-get -yqq install nginx---> Using cache---> 3c834a6164b3 Step 4 : RUN mkdir -p /var/www/html/website---> Using cache---> 5044773f5e09 Step 5 : ADD nginx/global.conf /etc/nginx/conf.d/---> cfee19df85f2 Removing intermediate container 0eddbc45f54d Step 6 : ADD nginx/nginx.conf /etc/nginx/nginx.conf---> dbf25a20d66d Removing intermediate container 8fbdd8c0eb26 Step 7 : EXPOSE 80---> Running in 0e4ef7402519---> 2b909217eb99 Removing intermediate container 0e4ef7402519 Successfully built 2b909217eb99 [root@host sample]#
转载于:https://www.cnblogs.com/jxlsblog/p/9826974.html
docker build no such file or directory相关推荐
- Visual studio docker build no such file or directory
在我构建新的镜像的时候, 发生 了 no such file or directory 的错误. 这个错误找了半天, 没头绪,项目结构是这样的: WebApplication1 建立在根目录下,是 ...
- 【Tiny4412】 编译dnw源码报错 /lib/modules/2.6.32-431.el6.x86_64/build/: No such file or directory
1. 今天编译dnw源码的时候出现如下错误: /lib/modules/2.6.32-431.el6.x86_64/build/: No such file or directory 截图如下: 2. ...
- Linux编译遇到各种错误解决方法,例如 /lib/modules/3.10.0-(xxx).el7.x86_64/build: No such file or directory. Stop.
Linux编译遇到各种错误解决方法,例如: /lib/modules/3.10.0-(xxx).el7.x86_64/build: No such file or directory. Stop. 背 ...
- docker 出现错误:no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS
docker 出现错误:Get http:///var/run/docker.sock/v1.19/version: dial unix /var/run/docker.sock: no such f ...
- docker build: COPY/ADD报错:not a directory
注:本文基于CentOS 6.5 3.10内核,docker版本1.7.1 背景 制作docker镜像时,要把一个文件拷贝至镜像中,可以使用ADD或者COPY命令,但是使用的时候一直报错. [root ...
- docker load 出错 open /var/lib/docker/tmp/docker-import-837327978/bin/json: no such file or directory
1. 问题现象 使用 docker load 加载镜像包的时候出现如下错误: open /var/lib/docker/tmp/docker-import-837327978/bin/json: no ...
- dockercompose up build fail (node no such file or directory packages.json )
docker构建项目遇到如下问题: npm ERR! Darwin 15.0.0 npm ERR! argv "/usr/local/lib/node_modules/iojs-bin/no ...
- 使用nsenter进入docker容器后端报错 mesg: ttyname failed: No such file or directory
通过nsenter 进入到docker容器的后端总是报下面的错,, [root@devdtt ~]# docker inspect -f {{.State.Pid}} mynginx4 11950 [ ...
- linux 安装simg2img,linux可执行文件执行时提示No such file or directory(docker环境中运行的ubuntu镜像)...
linux下在转换system.img文件类型时,提示 首先进入到了可执行文件所在目录下,并将system.img也放在同一目录下: 查看文件信息,可以看到文件是存在的,并且是可以执行的. 于是执行如 ...
最新文章
- 如何得到数据库中所有表字段及字段中文描述
- 消息队列优缺点和选型
- ipvsadm+keepalived安装错误解决
- Netweaver的传输机制和SAP Cloud for Customer
- 学姐,来挑战字节最牛部门
- 小米首部5G手机正式发布 海外营收将很快超过国内
- 2018年7月1日笔记
- 手写SpringIOC注解版本
- 【转】javascript 只允许输入数字总结
- 小米路由器刷 linux,小米路由器刷入Padavan系统
- office VBA开发视频教程
- luac 格式分析与反编译
- pyhton中matplotlib箱线图的绘制(matplotlib双轴图、箱线图、散点图以及相关系数矩阵图))...
- BATH四巨头鼎立,中国云市场将走向何方?
- 手机safari导入html书签,苹果手机safari书签及其历史记录怎么恢复
- JustinMind原型制作工具
- 说一说我在创建星球这10多天,在星球里干了啥?
- 搭建Jumpserver服务器管理公司服务器
- 用一条SQL 语句 查询出每门课都大于80 分的学生姓名
- 3000字/16张炫酷动态图,推荐一款好用到爆的Python可视化利器
热门文章
- Linux连接荣耀路由器pro2,荣耀路由pro2和电脑怎么连接?连接一体机方法
- java二级分销排行统计_直播分销系统排行
- 天线下倾角示意图_《天线和下倾角.ppt
- 树莓派C语言点灯,树莓派3 b GPIO 点亮小灯泡
- eclipse中导入SVN项目步骤
- 搭建简单的SpringBoot开发环境
- MiniProfiler 兼容 Entity Framework 6
- mysql delete|删除 命令的注意点
- 程序员创业的两难困境
- python爬虫 被重定向_爬虫篇 | 认识Python最最最常用语重要的库Requests