使用Docker启动mariaDB容器和启动脚本

时间:2018-07-24 12:50:01

标签: java docker mariadb docker-java

我正在通过 W/System.err: java.net.ConnectException: Failed to connect to /127.0.0.1:80 at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:143) at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112) at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184) at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:258) at org.schools.loginregister.LoginActivity$AsyncLogin.doInBackground(LoginActivity.java:103) at org.schools.loginregister.LoginActivity$AsyncLogin.doInBackground(LoginActivity.java:59) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) D/EGL_emulation: eglMakeCurrent: 0xcdb6f720: ver 3 0 (tinfo 0xe5efebf0) D/EGL_emulation: eglMakeCurrent: 0xcdb6f720: ver 3 0 (tinfo 0xe5efebf0) D/EGL_emulation: eglMakeCurrent: 0xcdb6f720: ver 3 0 (tinfo 0xe5efebf0) 通过Java创建docker run选项的mariaDB容器。我不知道如何确定何时可以将容器与JDBC客户端连接。我如何确定初始脚本何时停止执行以及数据库是否可以正常工作?我想避免使用-v pathToSQL:/docker-entrypoint-initdb.d/script.sql之类的东西,这是我目前的解决方案。我想实现以下目标:

Thread.sleep(20000)

0 个答案:

没有答案