没有不值得去解决的问题,也没有不值得去学习的技术!

Troubleshooting “Error Processing Tar File (Exit Status 1): Unexpected EOF”

While building the image in Jenkins, an error occurred: Error processing tar file(exit status 1): unexpected EOF.

1. While building the image in Jenkins, an error occurred: Error processing tar file(exit status 1): unexpected EOF. See Figure 1.

While building the image in Jenkins, an error occurred: Error processing tar file(exit status 1): unexpected EOF.
Figure 1
Plaintext

Step 10/10 : RUN chown -R nginx:nginx /mcloud/ &&     chmod 777 /mcloud/cmp_main/data &&     chmod 777 /usr/share/sync.sh &&     chmod 777 /mcloud/cmp_main/attachment &&     chmod +x /config/init/* &&     chmod +x /etc/nginx/conf.d/* &&     chmod +x /etc/supervisord.d/* &&     rm -rf /mcloud/cmp_main/data/tpl/ &&     rm -rf /etc/nginx/conf.d/status.conf
 ---> Running in 800972ee06bc
Error processing tar file(exit status 1): unexpected EOF
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE

2. After reviewing the Dockerfile, it appears that having too many ADD commands caused insufficient space. Reference URL: https://stackoverflow.com/questions/42784396/docker-error-error-processing-tar-fileexit-status-1-unexpected-eof . See Figure 2.

After reviewing the Dockerfile, it appears that having too many ADD commands caused insufficient space.
Figure 2
Dockerfile

ADD code /mcloud/cmp_main
ADD code/build/c_files/ /
ADD code/build/sync.sh /usr/share/sync.sh
ADD code/build/cacheJsSDK.sh /usr/share/cacheJsSDK.sh
ADD code/build/MP_verify_3RUFnkMVef9eh3mJ.txt /mcloud/cmp_main/
ADD code/build/MP_verify_qxIMkC3go7fNqBzb.txt /mcloud/cmp_main/

RUN sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && \
    sed -i 's/disable_functions = exec,system/disable_functions = system/g' /usr/local/php/etc/php.ini

RUN chown -R nginx:nginx /mcloud/ && \
    chmod 777 /mcloud/cmp_main/data && \
    chmod 777 /usr/share/sync.sh && \
    chmod 777 /mcloud/cmp_main/attachment && \
    chmod +x /config/init/* && \
    chmod +x /etc/nginx/conf.d/* && \
    chmod +x /etc/supervisord.d/* && \
    rm -rf /mcloud/cmp_main/data/tpl/ && \
    rm -rf /etc/nginx/conf.d/status.conf

3. Move /build/sync.sh to /build/c_files/usr/share/sync.sh. Move /build/cacheJsSDK.sh to /build/c_files/usr/share/cacheJsSDK.sh. Move /build/MP_verify_3RUFnkMVef9eh3mJ.txt to /build/c_files/mcloud/cmp_main/MP_verify_3RUFnkMVef9eh3mJ.txt. Move /build/MP_verify_qxIMkC3go7fNqBzb.txt to /build/c_files/mcloud/cmp_main/MP_verify_qxIMkC3go7fNqBzb.txt. Edit the Dockerfile and remove 4 ADD lines. See Figure 3.

Move /build/sync.sh to /build/c_files/usr/share/sync.sh. Move /build/cacheJsSDK.sh to /build/c_files/usr/share/cacheJsSDK.sh. Move /build/MP_verify_3RUFnkMVef9eh3mJ.txt to /build/c_files/mcloud/cmp_main/MP_verify_3RUFnkMVef9eh3mJ.txt. Move /build/MP_verify_qxIMkC3go7fNqBzb.txt to /build/c_files/mcloud/cmp_main/MP_verify_qxIMkC3go7fNqBzb.txt. Edit the Dockerfile and remove 4 ADD lines.
Figure 3
Dockerfile

RUN sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && \
    sed -i 's/disable_functions = exec,system/disable_functions = system/g' /usr/local/php/etc/php.ini

ADD code /mcloud/cmp_main
ADD code/build/c_files/ /

RUN chown -R nginx:nginx /mcloud/ && \
    chmod 777 /mcloud/cmp_main/data && \
    chmod 777 /usr/share/sync.sh && \
    chmod 777 /mcloud/cmp_main/attachment && \
    chmod +x /config/init/* && \
    chmod +x /etc/nginx/conf.d/* && \
    chmod +x /etc/supervisord.d/* && \
    rm -rf /mcloud/cmp_main/data/tpl/ && \
    rm -rf /etc/nginx/conf.d/status.conf

4. Build again. The first build failed with the error: unknown parent image ID sha256:. However, the second build succeeded. See Figure 4.

Build again. The first build failed with the error: unknown parent image ID sha256:. However, the second build succeeded.
Figure 4

5. The image sizes before and after the adjustment were 4711 and 3882, respectively. The size decreased by 4711 – 3882 = 829. See Figure 5.

The image sizes before and after the adjustment were 4711 and 3882, respectively. The size decreased by 4711 - 3882 = 829.
Figure 5

6. Another possible cause is that the Dockerfile has just undergone major modifications. In this case, I recommend building a few more times. It will eventually build successfully.

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系