After referring this official jenkins docker pipeline official documentation, started using the method such as,

dockerImage.withRun(){
  ... some scripts ...
}

Even i have added the HEALTHCHECK command in Dockerfile, after building the image and when go for withRun() method, the scripts inside withRun(){ } executes before the container becomes healthy.

Inside the method, again same healthy check required. It looks some thing strange, so how can i avoid this unwanted step. Or Am i missing some thing ?

Edit 1 :

Example Docker file used:

FROM mysql:5.7

ENV MYSQL_ROOT_PASSWORD password
ENV MYSQL_DATABASE mydb
ENV MYSQL_USER me
ENV MYSQL_PASSWORD password

HEALTHCHECK CMD /usr/bin/mysql --user=root --password=password --execute "SHOW DATABASES;"

CMD while true; do sleep 2; done

0 Answers