Docker在容器内运行

时间:2019-03-15 09:24:56

标签: python docker

我有一个使用docker的Python方法代码,我试图理解它。方法在这里,

    render(){
    return(
        <div className="kr-logincontent">
                <div className="kr-themetabs">
                    <ul className="kr-tabnavloginregistered" role="tablist">
                        <li role="presentation" className="active"><a href="#kr-loging" data-toggle="tab" aria-expanded="false">Log in</a></li>
                        <li role="presentation" className=""><a href="#kr-register" data-toggle="tab" aria-expanded="true">Register</a></li>
                    </ul>
                    <div className="tab-content kr-tabcontentloginregistered">
                        <div role="tabpanel" className="tab-pane fade active in" id="kr-loging">
                            <form onSubmit={this.login} className="kr-formtheme kr-formlogin">
                                <fieldset>
                                    <div className="form-group kr-inputwithicon">
                                        <i className="icon-profile-male"></i>
                                        <input value={this.state.user} onChange={this.login_data} type="text" name="user" className="form-control" placeholder="Username Or Email"/>
                                    </div>
                                    <div className="form-group kr-inputwithicon">
                                        <i className="icon-icons208"></i>
                                        <input value={this.state.login_pass}onChange={this.login_data}  type="password" name="login_pass" className="form-control" placeholder="Password"/>
                                    </div>
                                    <div className="form-group">
                                        <div className="kr-checkbox">
                                            <input type="checkbox" name="remember" id="rememberpass2"/>
                                            <label htmlFor="rememberpass2">Remember me</label>
                                        </div>
                                        <span><a href="#">Lost your Password?</a></span>
                                    </div>
                                    <button className="kr-btn kr-btngreen" >login</button>
                                </fieldset>
                            </form>
                        </div>
                        <div role="tabpanel" className="tab-pane fade " id="kr-register">
                            <form onSubmit={this.register} className="kr-formtheme kr-formlogin">
                                <fieldset>
                                    <div className="form-group kr-inputwithicon">
                                        <i className="icon-profile-male"></i>
                                        <input type="text" onChange={this.regi_data} value={this.state.fname} name="fname" className="form-control" placeholder="Firstname"/>
                                    </div>
                                    <div className="form-group kr-inputwithicon">
                                        <i className="icon-profile-male"></i>
                                        <input type="text" onChange={this.regi_data} value={this.state.lname} name="lname" className="form-control" placeholder="Lastname"/>
                                    </div>
                                    <div className="form-group kr-inputwithicon">
                                        <i className="icon-icons208"></i>
                                        <input type="email" onChange={this.regi_data} value={this.state.emailaddress} name="emailaddress" className="form-control" placeholder="Email Address"/>
                                    </div>
                                    <div className="form-group kr-inputwithicon">
                                        <i className="icon-lock-stripes"></i>
                                        <input type="password" onChange={this.regi_data} value={this.state.password}  name="password" className="form-control" placeholder="Password"/>
                                    </div>
                                    <div className="form-group kr-inputwithicon">
                                        <i className="icon-phone"></i>
                                        <input type="number" onChange={this.regi_data} value={this.state.mobile} name="mobile" className="form-control" placeholder="Mobile"/>
                                    </div>
                                    <button className="kr-btn kr-btngreen">Register</button>
                                </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
                <div className="kr-shareor"><span>or</span></div>
                <div className="kr-signupwith">
                    <h2>Sign in With...</h2>
                    <ul className="kr-signinloginwithsocialaccount">
                        <li className="kr-facebook"><a href="javascript:void(0);"><i className="icon-facebook-1"></i><span>Facebook</span></a></li>
                        <li className="kr-twitter"><a href="javascript:void(0);"><i className="icon-twitter-1"></i><span>Twitter</span></a></li>
                        <li className="kr-googleplus"><a href="javascript:void(0);"><i className="icon-google4"></i><span>Google +</span></a></li>
                    </ul>
                </div>
                <div className="otp_modal">
                    <Otp ref={this.otpModalRef} ></Otp>
                </div>
            </div>
    )
}

我在调试时得到了屏幕截图,

enter image description here

找到def exec(self, container_target, command, additional_options=""): """ execte docker exec commmand and return the stdout or None when error""" cmd = """docker exec -i "%s" sh -c '%s' %s""" % ( container_target, command, additional_options) if self.verbose: print(cmd) try: cp = subprocess.run(cmd, shell=True, check=True, stdout=subprocess.PIPE) return cp.stdout.decode("utf-8").strip() except Exception as e: print(f"Docker exec failed command {e}") return None 值,

  

'docker exec -i“ craft_p2-2” sh -c \'cd craft && composer show   --name-only | grep书呆子和公司/示意图| wc -l \''

我的理解是使用名为cmd的容器的外壳并进入名为craft_p2-2的文件夹的代码。然后,它检查是否安装了craft插件。那是对的吗?

这对于某些人可能是显而易见的,但是,我没有大量的容器知识,因此需要确定正在发生的事情。

0 个答案:

没有答案