我想在容器启动时设置一些配置,为此我使用的是shell脚本.但是我的容器会在脚本结束后立即退出,我尝试使用-d标志/分离模式,但它永远不会以分离模式运行.
下面是我的Dockerfile
FROM ubuntu:14.04
ADD shell.sh /usr/local/bin/shell.sh
RUN chmod 777 /usr/local/bin/shell.sh
CMD /usr/local/bin/shell.sh
Run Code Online (Sandbox Code Playgroud)
下面是我的shell脚本
#!/bin/bash
echo Hello-docker
Run Code Online (Sandbox Code Playgroud)
没有任何标志运行
docker run hello-docker
Run Code Online (Sandbox Code Playgroud)
这将在我的控制台上打印"Hello-docker"并退出
使用-itd标志运行
docker run -itd hello-docker
Run Code Online (Sandbox Code Playgroud)
我看到的差异在COMMAND部分,当我运行其他图像命令部分将显示"/ bin/bash"并将继续处于分离模式.
当我在带有shell脚本的容器中运行我的图像时,COMMAND部分将显示"/ bin/sh -c/usr/loca"和Exit.
我想运行容器直到我不能手动停止它.
编辑:
在Dockerfile中添加ENTRYPOINT指令后,这将不会执行我的shell脚本:(
FROM ubuntu:14.04
ADD shell.sh /usr/local/bin/shell.sh
RUN chmod 777 /usr/local/bin/shell.sh
CMD /usr/local/bin/shell.sh
ENTRYPOINT /bin/bash
Run Code Online (Sandbox Code Playgroud)
根据这里的 docker文档
使用备用参数运行容器时将覆盖CMD,因此如果我使用如下所示的某些参数运行docker image,则不会执行CMD指令.:(
sudo docker run -it --entrypoint=/bin/bash <imagename>
Run Code Online (Sandbox Code Playgroud) 我在URL Rewrite中得到了这个角色.用__CODE__to 重写每个请求到网站__CODE__
<rule name="Force HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
Run Code Online (Sandbox Code Playgroud)
我需要在此角色中使用其他角色或异常来重写或将特定URL重定向到HTTP.
那可能吗?谢谢.
当我创建一个新的Laravel项目时,浏览器显示错误500.我在日志中发现了这个:
PHP Parse错误:语法错误,意外'?' 在233行的vendor/laravel/framework/src/Illuminate/Foundation/helpers.php中
233中的代码是:
return app('cache')->get($arguments[0], $arguments[1] ?? null);
Run Code Online (Sandbox Code Playgroud)
但据我所知,??PHP 7.0支持null合并operator()
我的PHP版本:
PHP 7.1.8-2 + ubuntu14.04.1 + deb.sury.org + 4(cli)(内置:2017年8月4日14:34:05)(NTS)版权所有(c)1997-2017 PHP Group Zend Engine v3. 1.0,版权所有(c)1998-2017 Zend Technologies与Zend OPcache v7.1.8-2 + ubuntu14.04.1 + deb.sury.org + 4,版权所有(c)1999-2017,作者:Zend Technologies
Laravel版本:5.5.0
谁知道发生了什么?
请参阅下面的表单HTML代码
<form method="post" action="register">
<div class="email">
Email <input type="text" tabindex="1" id="email" value="" name="email"> </div>
</div>
<div class="agreement">
<div tabindex="2" class="terms_radio">
<div onclick="changeTerm(this);" class="radio" id="terms_radio_wrapper" style="background-position: left 0pt;">
<input type="radio" id="terms" value="1" name="terms"><label for="terms">I have read and understood the</label>
</div>
</div>
</div>
<div class="form_submit">
<input type="button" tabindex="3" value="Cancel" name="cancel">
<input type="submit" tabindex="4" value="Submit" name="submit">
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
在这里,我设置了协议复选框,使得无线电输入完全隐藏,并且背景图像应用于包装器div,并且包装div的onclick将切换背景图像以及无线电输入的检查状态.
我需要在'terms_radio'DIV上设置tabindex索引,只是tab上的tabindex ="2"属性不起作用,
当光标位于电子邮件输入字段时,是否可以在按TAB时将无线电输入标签上的虚线边框带上?
我有2个关于ScrollView的问题.一个是我的主要问题,另一个是次要的混乱.
1.什么到底是contentOffset和contentInset的ScrollView?我将在下面提供更多详情.
我创造了一个ScrollView,但似乎ScrollView无法向任何方向滚动.这是关于抵消的问题吗?还是插图?我将在下面提供更多详情.
问题1的详细信息:
有时contentOffset属性和contentInset属性似乎有很多不同,但是当我尝试实现一些与这两个属性相关的函数时,我感到困惑.我在这里做一个简单的说明.你能帮我弄清楚哪个部分是偏移的,哪个部分是插入的?
问题2的详细信息:
我使用以下功能添加一个 ScrollView
func addScrollView(){
// assign a new ScrollView to "scroll" class member
scroll = UIScrollView(frame: CGRectZero)
scroll!.translatesAutoresizingMaskIntoConstraints = false
// change it to gray color to help recognising
scroll!.backgroundColor = UIColor.grayColor()
self.view.addSubview(scroll!)
//add some constraints,[you can neglect following part]
let x = NSLayoutConstraint(item: scroll!, attribute: NSLayoutAttribute.CenterX, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.CenterX, multiplier: 1, constant: 0)
self.view.addConstraint(x)
let y …Run Code Online (Sandbox Code Playgroud) 我正在写一个Android聊天应用程序.我正在监听连接,我收到数据,我可以看到它Log.d,但每当我尝试更新我的UI时,应用程序崩溃.
代码段:
private class chatReceiver implements Runnable {
@Override
public void run() {
try {
skt = new DatagramSocket(Integer.parseInt(Main.prefs.getString("port_number", "5432")));
DatagramPacket rcvPkt = new DatagramPacket(rcvBuf,rcvBuf.length);
String ack = "Hello from our SimpleUDPServer";
byte[] sndBuf = ack.getBytes();
while (true) {
Log.d("Server received: " ,"entered loop");
skt.receive(rcvPkt);
String rcvMsg = new String(rcvBuf, 0, rcvPkt.getLength(), "UTF-8");
Log.d("Server received: " ,"receiving" + rcvMsg);
if (rcvMsg != null) {
Log.d("Server received: " ,"not equal null");
// I want to update my UI here …Run Code Online (Sandbox Code Playgroud) 我试图用SQL Server选择第二行.所以我写了一个这样的查询:
SELECT TOP 1 * From Cinema
WHERE CinemaID!=(SELECT TOP 1 CinemaID
FROM Cinema
ORDER BY CinemaID DESC)
ORDER BY CinemaID DESC
Run Code Online (Sandbox Code Playgroud)
它做了我需要的.但我想只用一个选择做同样的事情.
我读到MySql中的LIMIT子句就是这样做的.但我找不到任何相同的东西.所以我很欣赏任何寻找有用的东西的帮助.
如何从Angular 4中的select选项中获取值?
我想将它分配给component.ts文件中的新变量.我试过这个,但没有输出.
你也可以用[(ngModel)]吗?
component.html
<form class="form-inline" (ngSubmit)="HelloCorp(f)" #f="ngForm">
<div class="select">
<select class="form-control col-lg-8" #corporation required>
<option *ngFor="let corporation of corporations" [value]="corporationObj">{{corporation.corp_name}}</option>
</select>
<button type="submit" class="btn btn-primary manage">Submit</button>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
component.ts
HelloCorp() {
const corporationObj = corporation.value;
}
Run Code Online (Sandbox Code Playgroud) 我遇到了问题,我不知道为什么会这样,以及如何解决它.我正在使用python和pygame开发一个Videogame,我收到了这个错误:
File "/home/matt/Smoking-Games/sg-project00/project00/GameModel.py", line 15, in Update
self.imageDef=self.values[2]
TypeError: 'NoneType' object has no attribute '__getitem__'
Run Code Online (Sandbox Code Playgroud)
代码:
import pygame,components
from pygame.locals import *
class Player(components.Entity):
def __init__(self,images):
components.Entity.__init__(self,images)
self.values=[]
def Update(self,events,background):
move=components.MoveFunctions()
self.values=move.CompleteMove(events)
self.imageDef=self.values[2]
self.isMoving=self.values[3]
def Animation(self,time):
if(self.isMoving and time==1):
self.pos+=1
if (self.pos>(len(self.anim[self.imageDef])-1)):
self.pos=0
self.image=self.anim[self.imageDef][self.pos]
Run Code Online (Sandbox Code Playgroud)
你能解释一下这个错误意味着什么以及为什么会这样,我能解决它吗?
我正在Windows上运行MySQL 5.5,尝试使用mysqldump:
"C:\WebServer\MySQL Server 5.5\bin\mysqldump.exe" -u user -ppassword database > "C:\backup.sql"
Run Code Online (Sandbox Code Playgroud)
但得到错误:
mysqldump:未知选项' - no beep'
这是一个非常基本的命令,并且可以在另外两个开发盒上运行,所以不确定是什么导致这个?
android ×1
angular ×1
asp.net ×1
bash ×1
docker ×1
dockerfile ×1
html ×1
iis ×1
input ×1
ios ×1
label ×1
laravel-5.5 ×1
mysql ×1
option ×1
python ×1
radio-button ×1
select ×1
sh ×1
shell ×1
sql-server ×1
swift ×1
tabindex ×1
typeerror ×1
web-config ×1
windows ×1