I have reviewed some of the other answers here on SO and I do not think any of them apply to me (e.g. I have no .dockerignore
).
I have a docker file that contains the following:
COPY php-config/nginx.conf /etc/nginx/nginx.conf
COPY php-config/fpm-pool.conf /etc/php/8.0/fpm/pool.d/www.conf
COPY php-config/php.ini /etc/php/8.0/fpm/conf.d/99-custom.ini
COPY php-config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
The build process (I'm using kaniko
via gitlab
to build an image https://docs.gitlab.com/ee/ci/docker/using_kaniko.html ) appears to perform the neceessary actions:
INFO[0253] Taking snapshot of full filesystem...
INFO[0253] COPY php-config/nginx.conf /etc/nginx/nginx.conf
INFO[0253] Taking snapshot of files...
INFO[0253] COPY php-config/fpm-pool.conf /etc/php/8.0/fpm/pool.d/www.conf
INFO[0253] Taking snapshot of files...
INFO[0253] COPY php-config/php.ini /etc/php/8.0/fpm/conf.d/99-custom.ini
INFO[0253] Taking snapshot of files...
INFO[0253] COPY php-config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
INFO[0253] Taking snapshot of files...
However I get an error on attempting to docker run
the container after successful build :
Error: could not find config file /etc/supervisor/conf.d/supervisord.conf
For help, use /usr/bin/supervisord -h
I can confirm that all four files exist in the source directory.
I can also confirm that all the destination directories exist (i.e. I have inspected the image via docker run --rm -it *pathtocontainer* bash
). My manual inspection also confirms only 3/4 files actually copied.
=======
Re: Question in Comments
INFO[0253] COPY php-config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
INFO[0253] Taking snapshot of files...
INFO[0253] RUN ls -gAlFh /etc/supervisor/conf.d
INFO[0253] cmd: /bin/sh
INFO[0253] args: [-c ls -gAlFh /etc/supervisor/conf.d]
INFO[0253] Running: [/bin/sh -c ls -gAlFh /etc/supervisor/conf.d]
total 4.0K
-rw-rw-rw- 1 root 459 Jul 5 16:13 supervisord.conf
INFO[0253] Taking snapshot of full filesystem...
INFO[0253] RUN mkdir /run/nginx && chown -R nobody:nogroup /usr/share/nginx && chown -R nobody:nogroup /run/nginx && chown -R nobody:nogroup /var/log/nginx
INFO[0253] cmd: /bin/sh
INFO[0253] args: [-c mkdir /run/nginx && chown -R nobody:nogroup /usr/share/nginx && chown -R nobody:nogroup /run/nginx && chown -R nobody:nogroup /var/log/nginx]
INFO[0253] Running: [/bin/sh -c mkdir /run/nginx && chown -R nobody:nogroup /usr/share/nginx && chown -R nobody:nogroup /run/nginx && chown -R nobody:nogroup /var/log/nginx]
INFO[0253] Taking snapshot of full filesystem...
INFO[0253] EXPOSE 8080
INFO[0253] cmd: EXPOSE
INFO[0253] Adding exposed port: 8080/tcp
INFO[0253] USER nobody
INFO[0253] cmd: USER
INFO[0253] CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
INFO[0253] Pushing image to foobar.example.com:5050/devops/debian/php:master
INFO[0259] Pushing image to foobar.example.com:5050/devops/debian/php:3259b0fd
INFO[0259] Pushing image to foobar.example.com:5050/devops/debian/php:latest
INFO[0259] Pushed image to 3 destinations
Cleaning up file based variables 00:01
Job succeeded