1

我已经在 SO 上查看了其他一些答案,我认为它们中的任何一个都不适用于我(例如,我没有.dockerignore)。

我有一个包含以下内容的 docker 文件:

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

构建过程(我正在使用kanikoviagitlab构建图像https://docs.gitlab.com/ee/ci/docker/using_kaniko.html)似乎执行了必要的操作:

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...   


 

但是,在成功构建后尝试docker run容器时出现错误:

Error: could not find config file /etc/supervisor/conf.d/supervisord.conf
For help, use /usr/bin/supervisord -h  

我可以确认所有四个文件都存在于源目录中。

我还可以确认所有目标目录都存在(即,我已通过 检查图像docker run --rm -it *pathtocontainer* bash)。我的手动检查还确认只有 3/4 文件实际复制。

=======

回复:评论中的问题

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
4

0 回答 0