0%

Docker 错误集合

no such file or directory

when build a Dockerfile ,and the file ‘redis.conf’ exists in real , but met such erro

Step 5 : RUN mkdir /usr/local/redis/
---> Running in 5cf73a52953f
---> 3351c41a56b4
Removing intermediate container 5cf73a52953f
Step 6 : COPY /home/dockerdir/Dockerfiles/redis.conf /usr/local/redis/conf/
**INFO[0007] home/dockerdir/Dockerfiles/redis.conf: no such file or directory** 

the reason:

  • if you build using STDIN (docker build - < somefile) , this is no build context ,so COPY can’t be used
  • COPY src dest ,here src just only filename without path ,so the file must exist in current build path ,and the dest must the folder with / or the certain filename

#INFO[0000] stat … not a directory
Step 5 : VOLUME /usr/local/redis/logs /usr/local/redis/var /usr/local/redis/conf
—> Using cache
—> a4ed3fb3bbfa
Step 6 : RUN chown -R redis:redis /usr/local/redis
—> Using cache
—> 338c50fe83bf
Step 7 : WORKDIR /usr/local/redis/conf/
—> Using cache
—> 00cbe70420b7
Step 8 : ADD redis.conf /usr/local/redis/conf
INFO[0000] stat /home/dockerdir/docker/devicemapper/mnt/58234d468c89c1e3877620fc6af37205e411ed86176de987e5336df6de8f9b27/rootfs/usr/local/redis/conf/redis.conf: not a directory

the reason

  • the reason is the same like above ,the ADD or COPY destination must be a folder with / or the certain filename

公众号: DailyJobOps DailyJobOps