Kaniko: RUN Not executed properly

Created on 18 Sep 2018  路  13Comments  路  Source: GoogleContainerTools/kaniko

Hi, am i new to this project, and i hope my issue will be an obvious fix :)

Actual behavior
When RUN mkdir /root/.ssh, the command is not interpreted correctly

We havbe the following error

>
INFO[0046] cmd: /bin/sh
INFO[0046] args: [-c mkdir /root/.ssh]
sh: unsupported crypt method: mkdir /root/.ssh
>

Expected behavior
The command mkdir is executed as expected

To Reproduce
Steps to reproduce the behavior:

  1. Demo project https://gitlab.com/Sadortun/kaniko-run-issue/-/jobs/99005698

Additional Information

FROM php:alpine as intermediate
WORKDIR /var/www/htnl
RUN mkdir /root/.ssh 
RUN ls -la .

Please provide either the Dockerfile you're trying to build or one that can reproduce this error.

  • Build Context
    Please provide or clearly describe any files needed to build the Dockerfile (ADD/COPY commands)
  • Kaniko Image (fully qualified with digest)
INFO[0020] Taking snapshot of full filesystem...        
INFO[0046] WORKDIR /var/www/html
INFO[0046] cmd: workdir                                 
INFO[0046] Changed working directory to /var/www/html 
INFO[0046] Creating directory /var/www/html
INFO[0046] No files were changed, appending empty layer to config. No layer added to image. 
INFO[0046] RUN mkdir /root/.ssh                         
INFO[0046] cmd: /bin/sh                                 
INFO[0046] args: [-c mkdir /root/.ssh]                  
sh: unsupported crypt method: mkdir /root/.ssh
Usage: sh [options]

Options:
  -c, --crypt-method METHOD     the crypt method (one of NONE DES MD5 SHA256 SHA512)
  -e, --encrypted               supplied passwords are encrypted
  -h, --help                    display this help message and exit
  -m, --md5                     encrypt the clear text password using
                                the MD5 algorithm
  -R, --root CHROOT_DIR         directory to chroot into
  -s, --sha-rounds              number of SHA rounds for the SHA*
                                crypt algorithms

error building image: error building stage: waiting for process to exit: exit status 2
ERROR: Job failed: command terminated with exit code 1
kinbug

All 13 comments

This is the error message from chpasswd.

The error in the description above does not match with the error in the referenced gitlab job, although it is similar.

INFO[0034] RUN mkdir /root/.ssh                         
INFO[0034] cmd: /bin/sh                                 
INFO[0034] args: [-c mkdir /root/.ssh]                  
--2018-09-18 19:22:18--  http://mkdir%20/root/.ssh
Resolving mkdir ... failed: Name does not resolve.
sh: unable to resolve host address 'mkdir '
error building image: error building stage: waiting for process to exit: exit status 4

@cugu Indeed, the message from this issue come from a local build attempt, I wanted to reproduce the issue on a public project

Let me know if I can provide any details that you might need. I can also grant you permissions on the test project.

I've run into the same issue. My fix is to just use gcr.io/kaniko-project/executor:v0.3.0 until it's fixed.

@bouk tested with 0.3.0, and i got the same issue.
https://gitlab.com/Sadortun/kaniko-run-issue/-/jobs/99457320

Can you please share your execution script / Dockerfile ?

@bouk Done some more tests, and it seems if i use the base image "docker:stable" i can execute commands

https://gitlab.com/Sadortun/kaniko-run-issue/-/jobs/99462747

But i tried other alpine based images, and no success 馃槩

@sadortun looking at the logs, you're not using v0.3.0: Using Docker executor with image gcr.io/kaniko-project/executor:debug

@bouk It is used in his newer builds: https://gitlab.com/Sadortun/kaniko-run-issue/-/jobs/99492775 but it ends in a Killed

I can reproduce that behavior locally as well.

@cugu @bouk Indeed, i was dooing 19 things at the same time, and i did not see that i was not commiting on the right branch :)

image

V0.3.0 doesnt work as expected either.

@cugu @bouk After more tests, here is an Update on the issue. Any help is greatly appreciated !

Working as expected

FROM nginx:alpine
COPY ./index.html /usr/share/nginx/html/index.html
RUN mkdir /root/.ssh

Working as expected

FROM richarvey/nginx-php-fpm:latest  
COPY ./index.html /usr/share/nginx/html/index.html
RUN ["mkdir", "/root/.ssh"]

NOT Working

FROM richarvey/nginx-php-fpm:latest  
COPY ./index.html /usr/share/nginx/html/index.html
RUN mkdir /root/.ssh
INFO[0013] RUN mkdir /root/.ssh                         
INFO[0013] cmd: /bin/sh                                 
INFO[0013] args: [-c mkdir /root/.ssh]                  
--2018-09-24 23:57:00--  http://mkdir%20/root/.ssh
Resolving mkdir ... failed: Name does not resolve.
sh: unable to resolve host address 'mkdir '

This is probably a similar issue as https://github.com/GoogleContainerTools/kaniko/issues/359#issuecomment-424044674 . In this case, busybox is not overwritten by GNU tar but by another binary like ping.

Indeed, fixed by #360

thanks guys!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tejal29 picture tejal29  路  4Comments

PatrickXYS picture PatrickXYS  路  4Comments

maurorappa picture maurorappa  路  4Comments

cdupuis picture cdupuis  路  4Comments

vvbogdanov87 picture vvbogdanov87  路  4Comments