4

I' m trying to run an entrypoint script which wait until the mysql database is ready like these two examples : example 1 and example 2

and as expected it fails with message "mysql not found" thus in the Dockerfile i added these two lines :

RUN apt-get update
RUN apt-get install mysql-client

but i'm getting a message that say : Package 'mysql-client' has no installation candidate

so i tried with default-mysql-client but getting another error: ERROR: Service 'api' failed to build: The command '/bin/sh -c apt-get install default-mysql-client' returned a non-zero code: 1

then i tried with mariadb-client but still getting the same error : ERROR: Service 'api' failed to build: The command '/bin/sh -c apt-get install default-mysql-client' returned a non-zero code: 1

this is my Dockerfile

FROM tomcat:10.0.0-M7-jdk11-openjdk-buster
COPY . /tmp
RUN cp /tmp/API.war /usr/local/tomcat/webapps
WORKDIR /tmp
RUN apt-get update
RUN apt-get install default-mysql-client

someone has an idea ?

ben624
  • 177
  • 1
  • 3
  • 11

1 Answers1

3

it was fixed, i just didn't paid attention to the part of the log before the error when it asked me to respond with yes or no because it just doesn't give time to respond and fails instantaneously :

Step 5/5 : RUN apt install default-mysql-client
 ---> Running in 4d5614df0d53


Reading package lists...
Reading state information...
The following additional packages will be installed:
  libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libmariadb3
  libreadline5 libsnappy1v5 libterm-readkey-perl mariadb-client-10.3
  mariadb-client-core-10.3 mariadb-common mysql-common
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
The following NEW packages will be installed:
  default-mysql-client libaio1 libconfig-inifiles-perl libdbd-mysql-perl
  libdbi-perl libmariadb3 libreadline5 libsnappy1v5 libterm-readkey-perl
  mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mysql-common
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 8228 kB of archives.
After this operation, 55.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.

so i just added the "-y" to the Dockerfile like this : RUN apt-get install default-mysql-client -y

ben624
  • 177
  • 1
  • 3
  • 11