Docker - docker-compose'version'没有任何配置选项 [英] Docker - docker-compose 'version' doesn't have any configuration options
问题描述
所以我使用Ubuntu 16.04,我成功安装了docker和docker-compose。
我阅读本教程:快速入门:Docker Compose and Rail s
但是这不工作...也许这个教程不行。
我有这个docker-compose.yml:
db:
image:postgres
web:
build:。
命令:bundle exec rails s -p 3000 -b'0.0.0.0'
volumes:
- 。:/ www / html
ports:
- 3000 :3000
depends_on:
- db
我总是遇到这个错误:
$ docker-compose run web rails new。 --force --database = postgresql --skip-bundle
错误:文件'./docker-compose.yml'中的验证失败,原因:
web服务的不支持的配置选项:'depends_on'
嗯,好的,我读了很多谷歌的结果,似乎我在一个troube,因为我使用Ubuntu。不幸的是,在Ubuntu中,Docker的最高版本数量只有1.5.2。 (我尝试下载1.7.1卷曲,但1.5.2自动安装。)
$ docker version
客户端:
版本:1.11.1
API版本:1.23
Go版本:go1.5.4
Git commit:5604cbe
内置:Tue Apr 26 23:43: 49 2016
操作系统/ Arch:linux / amd64
服务器:
版本:1.11.1
API版本:1.23
转到版本:go1.5.4
Git commit:5604cbe
内置:Tue Apr 26 23:43:49 2016
操作系统/ Arch:linux / amd64
你有什么想法,我该如何运行基于轨道码头码头?
我不能安装docker机器,因为我使用ubuntu,安装总是会失败。
但是我的PHP docker-compose.yml是好的,因为我可以运行它:tiny_smile:但是这个rails教程不是很好。
原因是你删除了你们正在关注的示例教程,并且它们是重要的。
因为,看着 docker
版本,你应该是一个版本的 docker-compose
高于1.6.x。
要确定这一点,您可以运行
$ docker-compose -v
在我的情况下,我得到我
docker-compose版本1.7.0,build 0d7bf73
如果您的版本有1.7.x或更高版本,那么以下信息绝对适用于您。
正在工作:
版本: 2'##< - 这行很重要,你删除了教程
服务:##< - 这行也
db:
image:postgres
web:
build:。
命令:bundle exec rails s -p 3000 -b'0.0.0.0'
volumes:
- 。:/ www / html
ports:
- 3000 :3000
depends_on:
- db
目前共有三个版本的撰写文件格式:
- 版本1,旧版格式。这是通过在YAML的根目录中省略
密钥来指定的。
- 版本2.x.这是在YAML的根目录下使用版本:'2'或版本:'2.1'
条目。
- 版本3.x,最新和推荐的版本,设计为
在Compose和Docker Engine的群组模式之间交叉兼容。
这是指定版本:'3'或版本:'3.1'等,条目
在YAML的根目录。
此外,这里还有一个 docker-compose
version / Composer文件矩阵:
撰写文件格式| Docker引擎发布
-------------------- | ----------------------
3.0; 3.1 | 1.13.0+
2.1 | 1.12.0+
2.0 | 1.10.0+
1.0 | 1.9.1。+
资料来源:从docker文档
- Compose支持版本1,最大为1.6.x。它将在以后的Compose版本中被废弃。
- Compose 1.6.0+支持版本2文件,并且需要版本1.10.0 +的Docker Engine。
- 引入新参数的版本2的升级仅适用于Docker Engine版本1.12.0 +
- 版本2.1的升级引入了仅适用于Docker Engine版本的新参数1.13.0+。该版本还允许在服务配置中指定默认的比例数字。
- 为了在Compose和Docker Engine的群组模式之间进行交叉兼容,版本3删除了几个选项,并添加了更多。
在Docker文档页面上,现在还有如何升级Compose文件的实用指南: / p>
其他有用的docker撰写文档:
I am newbie in the Docker world, I spent my holiday to learn this docker (however it is much harder than Vagrant). So I use Ubuntu 16.04, I installed successfully the docker and docker-compose.
I read this tutorial: Quickstart: Docker Compose and Rails But this is not working... maybe the tutorial is not fine.
I have this docker-compose.yml:
db:
image: postgres
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/www/html
ports:
- "3000:3000"
depends_on:
- db
I got this error always:
$ docker-compose run web rails new . --force --database=postgresql --skip-bundle
ERROR: Validation failed in file './docker-compose.yml', reason(s):
Unsupported config option for 'web' service: 'depends_on'
Mmmm, okay, I read a lot of google result, and it seems I am in a troube, because I use Ubuntu. Unfortunately the highest version number of docker in Ubuntu it is only 1.5.2. (I tried download the 1.7.1 with curl, but 1.5.2 installed automatically.)
$ docker version
Client:
Version: 1.11.1
API version: 1.23
Go version: go1.5.4
Git commit: 5604cbe
Built: Tue Apr 26 23:43:49 2016
OS/Arch: linux/amd64
Server:
Version: 1.11.1
API version: 1.23
Go version: go1.5.4
Git commit: 5604cbe
Built: Tue Apr 26 23:43:49 2016
OS/Arch: linux/amd64
Do you have any ideas, how can I run the rails based docker? I cannot install the docker machine, because I use ubuntu and the installation always will be failed.
However my PHP docker-compose.yml is fine, because I can run it :slight_smile: But this rails tutorial is not good.
The reason is you removed the two first lines of the example tutorial your are following, and they do matter.
Because, looking at the docker
version you do have you should be on a version of docker-compose
higher than 1.6.x.
To identify this, you can run
$ docker-compose -v
In my case that gets me
docker-compose version 1.7.0, build 0d7bf73
If your version there is 1.7.x or higher then the information bellow definitely apply to you.
This should be working:
version: '2' ## <- this line matter and you removed it out the tutorial
services: ## <- this line also
db:
image: postgres
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/www/html
ports:
- "3000:3000"
depends_on:
- db
There are currently three versions of the Compose file format:
- Version 1, the legacy format. This is specified by omitting a version key at the root of the YAML.
- Version 2.x. This is specified with a version: '2' or version: '2.1' entry at the root of the YAML.
- Version 3.x, the latest and recommended version, designed to be cross-compatible between Compose and the Docker Engine’s swarm mode. This is specified with a version: '3' or version: '3.1', etc., entry at the root of the YAML.
Additionally, here is a little docker-compose
version / Composer file matrix:
Compose file format | Docker Engine release --------------------|---------------------- 3.0 ; 3.1 | 1.13.0+ 2.1 | 1.12.0+ 2.0 | 1.10.0+ 1.0 | 1.9.1.+
Source: from docker documentation
- Version 1 is supported by Compose up to 1.6.x. It will be deprecated in a future Compose release.
- Version 2 files are supported by Compose 1.6.0+ and require a Docker Engine of version 1.10.0+.
- An upgrade of version 2 that introduces new parameters only available with Docker Engine version 1.12.0+
- An upgrade of version 2.1 that introduces new parameters only available with Docker Engine version 1.13.0+. This version also allows to specify default scale numbers inside the service’s configuration.
- Designed to be cross-compatible between Compose and the Docker Engine’s swarm mode, version 3 removes several options and adds several more.
On docker documentation pages there are also now practical guides on how to upgrade your Compose file:
Additional useful docker Compose documentation:
- List of all docker-compose versions
- Compose file version 1
- Compose file version 2
- Compose file version 3 (current)
这篇关于Docker - docker-compose'version'没有任何配置选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!