Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to dockers and continuously trying to learn it.

I am getting the mysql-standalone_1 | nc command is missing! and I am unable to get how to resolve it.

The scenario is my app should wait for MySQL to start getting connections and before that MySQL should wait for Eureka-server to start completely. I am using wait-for.sh script to control the startup of microservices.

This is my docker file



version: "3"
services:
    mysql-standalone:
        image: mysql:8.0.25
        environment:
            - MYSQL_ROOT_PASSWORD=root123M.
            - MYSQL_DATABASE=usermanagementappdp
        ports:
            - 3306:3306
        depends_on: ['eureka-server']
        volumes:
            - ./wait-for:/docker-entrypoint-initdb.d
        entrypoint: ["/docker-entrypoint-initdb.d/wait-for.sh", "eureka-server:8761", "--", "docker-entrypoint.sh"]

    phpmyadmin:
        image: phpmyadmin/phpmyadmin:latest
        restart: always
        environment:
            PMA_HOST: mysql-standalone
            PMA_USER: root
            PMA_PASSWORD: abcd
        ports:
            - 8085:80

    eureka-server:
        image: eureka-server
        ports:
            - 8761:8761
        build:
            context: "../Eureka-Server-For-User-Management-App"
            dockerfile: "Dockerfile"


    usermanagementapp-docker:
        image: usermanagementapp-docker:latest
        ports:
            - 8089:8089
        links:
            - eureka-server
        environment:
            EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://eureka-server:8761/eureka
            SPRING_DATASOURCE_URL: jdbc:mysql://mysql-standalone:3306/usermanagementappdp?allowPublicKeyRetrieval=true&autoReconnect=true&useSSL=false
        build:
            context: "./"
            dockerfile: "Dockerfile"
        #entrypoint: ["/wait-for.sh", "mysql-standalone:3306", "--", "['java','-jar','/app.jar']"]
        depends_on: ['mysql-standalone','eureka-server']


Have tried finding on the internet for the solution but have not found any. Please let me know if any other inputs are required from my side. Thanks in advance.


What I have tried:

I have tried using
command: ["RUN apt-get -q update && apt-get -qy install netcat"]
to install nc but its not working
Posted
Updated 21-Dec-21 7:49am

1 solution

We probably need to see the contents of wait_for.sh to be able to help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900