首页 \ 问答 \ Docker - MySQL容器不能继续运行(Docker - MySQL container does not keep running)

Docker - MySQL容器不能继续运行(Docker - MySQL container does not keep running)

我需要一些帮助在Docker容器中使用MySQL。 我认为Docker的全部意义在于隔离沙箱中的进程并让它们像正常进程一样运行 - 我没有得到这个功能。

每当我运行一个我自己的图像构建的MySQL容器时,它运行2秒钟,然后停止。 尝试使用docker run -i -t <imageid>给我这个:

root@CenturionX:/home/centurionx/Code/Git/gdms-rcon# docker run -i -t e2d
150221 05:25:21 mysqld_safe Logging to '/var/lib/mysql/28123b6d1dad.err'.
150221 05:25:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150221 05:25:21 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
root@CenturionX:/home/centurionx/Code/Git/gdms-rcon# 

为什么守护进程不能保持打开状态? 我有我的Dockerfile ,看起来像:

# This docker file constructs a MySQL database instance
FROM mysql:latest

ADD . /gdms-rcon/mysql
WORKDIR /gdms-rcon/mysql

ENTRYPOINT ["/usr/bin/mysqld_safe"]

EXPOSE 3306

还有一个fig.yml文件来帮助我自动化构建过程:

mysql:
  build: .
  volumes:
    - .:/gdms-rcon/mysql
  working_dir: /gdms-rcon/mysql
  ports:
    - "3306:3306"
  environment:
    - MYSQL_DATABASE=mydb
    - MYSQL_ROOT_PASSWORD=mypassword

I need some help with using MySQL in a Docker container. I thought the entire point of Docker was to isolate processes in sandboxes and have them run like normal processes - I am not getting this functionality.

Whenever I run a MySQL container that I have built from my own image, it runs for 2 seconds, then stops. Trying docker run -i -t <imageid> gives me this:

root@CenturionX:/home/centurionx/Code/Git/gdms-rcon# docker run -i -t e2d
150221 05:25:21 mysqld_safe Logging to '/var/lib/mysql/28123b6d1dad.err'.
150221 05:25:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150221 05:25:21 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
root@CenturionX:/home/centurionx/Code/Git/gdms-rcon# 

Why does the daemon not stay open? I have my Dockerfile, which looks like:

# This docker file constructs a MySQL database instance
FROM mysql:latest

ADD . /gdms-rcon/mysql
WORKDIR /gdms-rcon/mysql

ENTRYPOINT ["/usr/bin/mysqld_safe"]

EXPOSE 3306

And a fig.yml file to help me automate the build process:

mysql:
  build: .
  volumes:
    - .:/gdms-rcon/mysql
  working_dir: /gdms-rcon/mysql
  ports:
    - "3306:3306"
  environment:
    - MYSQL_DATABASE=mydb
    - MYSQL_ROOT_PASSWORD=mypassword

原文:https://stackoverflow.com/questions/28642483
更新时间:2022-11-07 21:11

最满意答案

如果要控制数组何时刷新,请将其包装在outputpanel中,并将其id放在rerender属性中,以导致数据需要更新。 在重新更新每个dom时,我不得不使用此方法重新附加一些自定义jQuery输入侦听器。

<apex:commandButton action="{!something}" rerender="scriptPanel"/>
<apex:outputPanel id="scriptPanel>
  <script>
     d = new Array();
     <apex:repeat value="{!objects}" var="object">
       d.push({
           element1: "{!objects.id}"            
       });
     </apex:repeat>
  </script>
</apex:outputPanel>

If you want to control when your array gets refreshed wrap it in an outputpanel and put its id in the rerender attribute of whatever causes the data to need an update. I had to use this previously to reattach some custom jQuery input listeners when every the dom was re-updated.

<apex:commandButton action="{!something}" rerender="scriptPanel"/>
<apex:outputPanel id="scriptPanel>
  <script>
     d = new Array();
     <apex:repeat value="{!objects}" var="object">
       d.push({
           element1: "{!objects.id}"            
       });
     </apex:repeat>
  </script>
</apex:outputPanel>

相关问答

更多
  • 您应该在负责该页面的Controller类中执行action方法,而不是“调用”页面。 如果你看一下你提到的页面,你应该在顶部看到类似上的action="..."属性链接到您提到的按钮标记 ...
  • 问题可能如下: masterListB抓取多个帐户的分配 for (Account oAcctB : trigger.old)循环中的代码从不检查是否处于“保持”状态的旧帐户是否为同一帐户 一种解决方案可能是进行以下编辑: /* Old condition replaced: if (oAcctB.current_services__c == 'Hold') { */ if (oAcctB.current_services__c == 'Hold' and oAcctB.Id == oAccount ...
  • 你可以给它一个id,然后使用document.getElementById()来获取它: 请注意,如果它位于其他元素中,您可能需要深入查看它,所以如果它位于
  • JSENCODE函数在Visualforce中可用。 查看http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_functions.htm 。 如果控制器中有变量jsString ,则可以使用以下命令将字符串设置为JS变量,并使用相应的转义: var myVar = {!JSENCODE(jsString)}; The JSENCODE function is available in Visualforce. ...
  • 你需要在周围放一个 。 您的代码将如下所示: {!tvar.ftypename}
  • 答案最终非常直接! 首先 - 事实证明, apex:pageBlockTable可以处理传递给value参数的任何类型的对象,无论是SObject数组还是MyFooBar对象数组。 第二 - 我们需要一个包装类来同时封装两个记录: public with sharing class LeadContactCompareWrapper { public static final String SALUTATION = 'Salutation'; public static final Stri ...
  • 重编辑...... 我不认为你可以使用标准的控制器。 使用自定义控制器,我能够获得当前用户的综合机会联系人列表: 页:
    如果我做对了你想存入 public list> options {get;set;} 可能的答案。 因此,更好的方法可能是将它存储在Question.Id到List的映射中 public Map> options {get;set;} ... for(COPE_Questions__C q : questions){ ridCount++; List l = new Lis ...
  • 如果要控制数组何时刷新,请将其包装在outputpanel中,并将其id放在rerender属性中,以导致数据需要更新。 在重新更新每个dom时,我不得不使用此方法重新附加一些自定义jQuery输入侦听器。
    您可以通过以下方式为Apex控制器使用JavaScript Remoting :