I have create a custom image for lamp stack with following files
ADD /home/ktpl/nayan/MyLamp/supervisord.conf /etc/supervisor/supervisord.conf
ADD /home/ktpl/nayan/MyLamp/apps.conf /etc/supervisor/conf.d/apps.conf
ADD /home/ktpl/nayan/MyLamp/entrypoint.sh /entrypoint.sh
ADD /home/ktpl/nayan/MyLamp/start.sh /start.sh
lstat home/ktpl/nayan/lamp/supervisord.conf: no such file or directory
ADD can be used to copy local files to image while building.
Couple of things:
/home/ktpl/nayan/lampis the valid directory
/home/ktpl/nayan/MyLampexists and files present in there.
As per the documentation of docker
The path must be inside the context of the build; you cannot ADD ../something /something, because the first step of a docker build is to send the context directory (and subdirectories) to the docker daemon.
If your files are in the same directory as you build image, then you may use below statements in
ADD ./supervisord.conf /etc/supervisor/supervisord.conf ADD ./apps.conf /etc/supervisor/conf.d/apps.conf ADD ./entrypoint.sh /entrypoint.sh ADD ./start.sh /start.sh
Of course, like it was mentioned in the other answer,
COPY can also be used.
FROM busybox ADD ./test.txt /test.txt CMD ls /
You can building image and running it shows file being added in the below image.
If all the files and directories present and still you see this problem, then check
.dockerignore has entry for the same.