我在Windows上使用Docker,当我试图用这个命令拉一个PHP图像时

$ docker pull php

我收到了这样的信息:

Using default tag: latest
latest: Pulling from library/php no matching manifest for windows/amd64 
        in the manifest list entries

我该如何解决这个问题?

我有一个Python(2.7)应用程序,它在我的dockerfile中启动:

CMD ["python","main.py"]

py在启动时打印一些字符串,然后进入循环:

print "App started"
while True:
    time.sleep(1)

只要我用-it标志启动容器,一切都能正常工作:

$ docker run --name=myapp -it myappimage
> App started

之后我可以通过日志看到相同的输出:

$ docker logs myapp
> App started

如果我尝试运行带有-d标志的相同容器,容器似乎正常启动,但我看不到任何输出:

$ docker run --name=myapp -d myappimage
> b82db1120fee5f92c80000f30f6bdc84e068bafa32738ab7adb47e641b19b4d1
$ docker logs myapp
$ (empty)

但容器似乎仍在运行;

$ docker ps
Container Status ...
myapp     up 4 minutes ... 

Attach也不显示任何东西:

$ docker attach --sig-proxy=false myapp
(working, no output)

有什么问题吗?“打印”在后台运行时表现不同吗?

码头工人版本:

Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.2
Git commit (client): a8a31ef
OS/Arch (client): linux/arm
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.2
Git commit (server): a8a31ef

CouchDB和Couchbase之间有什么本质区别吗?

是否有可能从Dockerfile构建镜像,并使用一个命令运行它? docker build命令用于构建Dockerfile, docker run -it命令用于运行映像。

是否存在这两个命令的组合,以使仅使用一个命令就可以更容易地构建和运行?

有64位的Visual Studio吗?为什么不呢?

我试图遵循数字海洋这篇文章中讨论的Redis安装过程,用于WSL(Windows Sub-System for Linux)。安装的Ubuntu版本为Ubuntu 18.04。

redis安装中的一切都很好,但当我试图运行这个sudo systemctl启动redis时,我得到了这个消息。

System has not been booted with systemd as init system (PID 1). Can't operate.

你知道我该怎么做吗?

我想从第一个中间件传递一些变量到另一个中间件,我试着这样做,但有“req。有些变量是一个给定的‘未定义’”。


//app.js
..
app.get('/someurl/', middleware1, middleware2)
...

////middleware1
...
some conditions
...
res.somevariable = variable1;
next();
...

////middleware2
...
some conditions
...
variable = req.somevariable;
...

在我问app.router之前,我想我至少应该解释一下我认为在使用中间件时会发生什么。要使用中间件,需要使用的函数是app.use()。当中间件正在执行时,它将使用next()调用下一个中间件,或者使它不再调用更多的中间件。这意味着我放置中间件调用的顺序很重要,因为一些中间件依赖于其他中间件,而靠近末尾的一些中间件甚至可能不被调用。

Today I was working on my application and had my server running in the background. I wanted to make some changes and refresh my page and see the changes immediately. Specifically, I was making changes to my layout. I couldn't get it to work so I searched Stack Overflow for the answer and found this question. It says to make sure that express.static() is beneath require('stylus'). But when I was looking at that OP's code, I saw that he had his app.router call at the very end of his middleware calls, and I tried to figure out why that was.

当我做我的express. js应用程序(3.0.0rc4版),我使用命令express app -sessions -css stylus和在我的app.js文件的代码来设置与我的app.router以上的express.static()和要求('stylus')调用。所以看起来,如果它已经这样设置了,那么它应该保持这样。

在重新安排我的代码,这样我就可以看到我的手写笔的变化,它看起来像这样:

app.configure(function(){
  //app.set() calls
  //app.use() calls
  //...
  app.use(app.router);
  app.use(require('stylus').middleware(__dirname + '/public'));
  app.use(express.static(__dirname + '/public', {maxAge: 31557600000}));
});

app.get('/', routes.index);

app.get('/test', function(req, res){
  res.send('Test');
});

So I decided that the first step would be to find out why it is important to even have app.router in my code. So I commented it out, started my app and navigated to /. It displayed my index page just fine. Hmm, maybe it worked because I was exporting the routing from my routes file (routes.index). So next I navigated to /test and it displayed Test on the screen. Haha, OK, I have no idea what app.router does. Whether it is included in my code or not, my routing is fine. So I am definitely missing something.

所以我的问题是:

谁能解释一下app.router是做什么的,它的重要性,以及我应该把它放在中间件调用的哪里?如果我能得到一个关于express.static()的简要解释,那就太好了。据我所知,express.static()是我的信息的缓存,如果应用程序找不到所请求的页面,它将检查缓存,看看它是否存在。

在docker文档的docker映像修剪中,可以使用-a标志来

删除所有未使用的图像,而不仅仅是悬挂的图像

后来

删除所有悬挂的图像。如果指定了-a,也将删除所有未被任何容器引用的图像。

有人能给我解释一下什么是悬空图像吗?悬空图像和未使用的图像有什么区别?

我在一个Docker容器里调查詹金斯。我想知道Jenkins容器也可以作为Docker宿主吗?我正在考虑的是从Jenkins内部为每个集成测试构建启动一个新的docker容器(以启动数据库、消息代理等)。因此,应该在集成测试完成后关闭容器。是否有理由避免以这种方式在另一个docker容器中运行docker容器?