1

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
Little Code
  • 1,315
  • 2
  • 16
  • 37
  • the error is **target**(dir) not found, not source... – Lei Yang Jul 05 '21 at 15:12
  • When you run the container, do you mount any volumes? – Hans Kilian Jul 05 '21 at 15:25
  • @LeiYang Nope. When I `bash` into the instance "/etc/supervisor/conf.d/" *does* exist. So you are incorrect, the target dir *does* exsit ! – Little Code Jul 05 '21 at 15:41
  • @HansKilian No, no volumes mounted, its just a simple container (static files get copied across at build time). – Little Code Jul 05 '21 at 15:42
  • @LittleCode, I think the point is that the error message says that `/etc/supervisor/conf.d/supervisord.conf` doesn't exist. That's the target file, not the source. – Hans Kilian Jul 05 '21 at 15:46
  • @HansKilian Well duh it doesn't exist ! As I said clearly. I asked `kaniko` to `COPY` four files. It only copied three files. I want to know why !!! The file *should* exsit if the `COPY` was done ! – Little Code Jul 05 '21 at 15:58
  • @HansKilian Also, just to make it clear, the error message appears when I *RUN* the container, *NOT* during the build process. (i.e. it originates from `CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]`). – Little Code Jul 05 '21 at 16:01
  • 1) does the source supervisord.conf exist? 2) If you can alter the dockerfile, add something like `RUN ls -gAlFh /etc/supervisor/conf.d` after the copy statements. This is just to provide debugging info - if the file exists after the copy (which seems likely) then it is being deleted by another process further down the line. – Software Engineer Jul 05 '21 at 16:07
  • @SoftwareEngineer re: your question 1 its in my question "I can confirm that all four files exist in the source directory." – Little Code Jul 05 '21 at 16:07
  • Ok, but part 2? – Software Engineer Jul 05 '21 at 16:08
  • Part 2 I am running a new build with the `RUN ls`, so standby ... But I can tell you there is nothing following the copy that could delete it. There are only four or five lines after COPY until the end of the file. The lines following COPY are :` # RUNDIR + PERMISSIONS RUN mkdir /run/nginx \ && chown -R nobody:nogroup /usr/share/nginx \ && chown -R nobody:nogroup /run/nginx \ && chown -R nobody:nogroup /var/log/nginx # NGINX EXPOSE 8080 # RUN USER nobody CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]`. Nothing there can delete things. – Little Code Jul 05 '21 at 16:10
  • Could it be a permissions error that is simply being misreported? Is the file accessible to the main supervisord process? – Software Engineer Jul 05 '21 at 16:11
  • @SoftwareEngineer see updated question with output from your request. – Little Code Jul 05 '21 at 16:14
  • Ok, the file is definitely there with the right permissions. Are you able to post the whole dockerfile? – Software Engineer Jul 05 '21 at 16:16
  • 2
    Do you need to run as `USER nobody`? Just to test, could you remove that and let it run as root inside the container? – Hans Kilian Jul 05 '21 at 16:33

0 Answers0