问题标签 [docker-compose]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
3646 浏览

windows - 在 Windows 上运行“docker-compose up”会引发“没有名为 fnctl 的模块”错误

设置:

  • Windows 7的
  • Docker v1.6.0,作为 Boot2docker 的一部分安装
  • Docker-compose v1.2.0

我使用pip安装了docker-compose

它似乎安装成功。但是,当我尝试在包含docker-compose.ymldocker-compose定义的目录中运行:up 时,出现以下异常:

我从与 docker 无关的不同帖子中了解到,之所以会引发此错误,是因为 fcntl 是 linux 原生的,而且很明显,我的 python windows 发行版缺少它。但是,那里的人指定的解决方法不一定适用于我的个人情况。

我也尝试了这里的步骤:https ://github.com/docker/compose/releases

我使用 curl 下载了 linux 存档(没有 unname 分辨率)并赋予执行权,但仍然:

有没有人知道在 Boot2docker VM 上安装 docker-compose 的任何解决方法/实际功能的方法?

0 投票
2 回答
3549 浏览

docker - 在 Docker Compose 日志中打印时间戳

我正在查看我的web日志docker-compose logs web,但我想为这些消息添加时间戳,因为现在它们完全脱离了上下文(不知道事件何时发生)。我试过docker-compose logs -t web了,但似乎 Docker Compose 不知道这个标志。

您知道如何使时间戳出现在 Docker Compose 日志中吗?

0 投票
1 回答
1040 浏览

python - Flask Web 应用程序,Node.js(队列)工作者。不能让码头工人工作

我有一个具有以下服务的应用程序:

  • web/- 在端口 5000 上保存并运行 python 3 烧瓶 Web 服务器。使用 sqlite3。
  • worker/- 有一个index.js文件是队列的工作人员。Web 服务器使用 json API over port 与此队列交互9730。worker 使用 redis 进行存储。工作人员还将数据本地存储在文件夹中worker/images/

现在我正在尝试使用 docker 和 docker-compose 完成所有这些工作。作为那些新手,我很挣扎。

web/Dockerfile

worker/Dockerfile

docker-compose.yml

docker-compose build工作并执行一切都很好。

现在这会启动 redis 服务器和烧瓶服务器,但不会启动工作程序(我知道这一点,因为我console.logworker/index.jsanddocker-compose up命令中没有打印它)。

然后我跑去boot2docker ip获取IP地址,当我访问它时,我得到一个Gateway timeout错误但在docker stderr上没有错误。

我一直在尝试进行一系列更改以使其以某种方式工作,但不能。我真的认为如果有人可以解释出了什么问题以及如何使我的设置正常工作会很有帮助。

0 投票
1 回答
299 浏览

ruby - How to setup nginx as reverse proxy for Ruby application (all running inside Docker)

I'm trying to set-up a simple reverse proxy using nginx and a Ruby application, but I also want to have it set-up inside of Docker containers.

I've reached the point where I can run the Ruby application from inside Docker and access the running service from the host machine (my Mac OS X using Boot2Docker). But I'm now stuck trying to implement the nginx part, as I've not used it before and it seems the majority of articles/tutorials/examples on the topic use Rails (rather than a simple Sinatra/Rack application) and also utilises sockets - which I've no need of as far as I'm aware.

I'm also using Docker Compose.

The complete directory structure looks like:

To see the contents of these files then refer to the following gist:

https://gist.github.com/Integralist/5cfd5c884b0f2c0c5d11

But when I run docker-compose up -d I get the following error:

I'm not sure what's causing this error (a bit of googling returns https://github.com/docker/compose/issues/563 but it seems a separate issue as far as I can tell?).

I'm also not entirely sure the nginx.conf is set-up correctly if I could get past this error. The config for nginx looks like it should do a reverse proxy properly (e.g. using frontend as the upstream app server, which should then resolve to the docker ip address for the front-end container -> as you'll see I've linked the two containers together so I'd expect the front-end app to be set as an alias inside /etc/hosts of the proxy container).

Does any one know what I might be missing?

Thanks.

0 投票
1 回答
570 浏览

ruby-on-rails - 使用 docker-compose(以前的 fig)链接 cron 映像

我正在使用 docker-compose(以前的 fig)在 docker 中运行一个简单的 rails 应用程序,如下所示:

码头工人-compose.yml

Dockerfile

我需要运行一些定期维护脚本,例如数据库备份、将站点地图 ping 到搜索引擎等。

我不想在我的主机上使用 cron,因为我更喜欢保持应用程序的可移植性,我的想法是使用 docker-compose 链接图像,例如https://registry.hub.docker.com/u/ hamiltont/docker-cron/使用 docker-compose。

rails 官方镜像没有启用 ssh,所以我不能只让 cron 容器通过 ssh 进入 Web 容器并运行脚本。

docker-compose 是否有办法让容器将 shell 放入链接的容器中以执行某些命令?

0 投票
12 回答
71424 浏览

docker - 如何在 docker 机器上挂载本地卷

我正在尝试将 docker-machine 与 docker-compose 一起使用。文件 docker-compose.yml 的定义如下:

运行时docker-compose up -d一切顺利,直到尝试执行命令并产生错误:

无法启动容器 b58e2dfa503b696417c1c3f49e2714086d4e9999bd71915a53502cb6ef43936d:[8] 系统错误:exec:“./run_web.sh”:stat ./run_web.sh:没有这样的文件或目录

本地卷未安装到远程计算机。使用 webapps 代码挂载本地卷的推荐策略是什么?

0 投票
1 回答
395 浏览

package - Docker-compose 运行容器

我正在尝试启动一个 zookeeper 实例和一个使用 docker-compose (docker-compose.yml 文件中的内容) 连接到 zookeeper 实例的进程。一旦 docker 为两个实体获取存储库并启动 zookeeper 实例,它就无法将进程连接到 zookeeper 实例并优雅地停止整个设置并抛出此错误 -

有人能告诉我如何用 docker-compose 解决这个问题吗?

Dockerfile -

码头文件看起来像这样 -

0 投票
18 回答
154483 浏览

node.js - Docker-compose:npm install 成功后,node_modules 不存在于卷中

我有一个具有以下服务的应用程序:

  • web/- 在端口 5000 上保存并运行 python 3 烧瓶 Web 服务器。使用 sqlite3。
  • worker/- 有一个index.js文件是队列的工作人员。Web 服务器使用 json API over port 与此队列交互9730。worker 使用 redis 进行存储。工作人员还将数据本地存储在文件夹中worker/images/

现在这个问题只涉及worker.

worker/Dockerfile

docker-compose.yml

当我运行时docker-compose build,一切都按预期工作,并且所有 npm 模块都/worker/node_modules按我的预期安装。

但是当我这样做时docker-compose up,我看到了这个错误:

原来没有任何模块存在/worker/node_modules(在主机或容器中)。

如果在主机上,我npm install,那么一切正常。但我不想那样做。我希望容器处理依赖项。

这里出了什么问题?

(不用说,所有的包都在package.json。)

0 投票
19 回答
717520 浏览

docker - 使用 Docker-Compose,如何执行多个命令

我想做这样的事情,我可以按顺序运行多个命令。

0 投票
4 回答
3134 浏览

django - docker-compose 不启动 postgres 图像

我正在为 django 应用程序创建一个 docker-compose 配置,Dockerfile 构建成功,但是当我组合它们时,django 返回一个问题——无法连接到 posgres。

我运行docker-compose run web bash,发现redis和posgres都无法连接。

我的 docker-compose.yml 文件:

我这样做时的错误信息docker-compose up

更新:

因为我设置了一个到其他图像的链接,docker在主机172.17.0.67上链接了pg,我需要将pg主机设置为docker官方文档中没有提到的那个地址。(这个地址每次都会改变,但是可以通过env获取)

现在,我遇到了另一个问题:

如果我将命令更改python /workspace/BreadTripServer/webapps/manage.py runserver 0.0.0.0:8000 --settings=configs.local_defaultpython /workspace/BreadTripServer/webapps/manage.py runserver,它可以正常工作,但我无法访问网页。