docker-compose里的links
docker-compose.yml文件内容version: '2'services:namenode:extends:file: hadoop-hdfs.ymlservice: namenodedatanode:extends:file: hadoop-hdfs.ymlservice: datanod...
·
docker-compose.yml文件内容
version: '2'
services:
namenode:
extends:
file: hadoop-hdfs.yml
service: namenode
datanode:
extends:
file: hadoop-hdfs.yml
service: datanode
depends_on:
- namenode
hadoop-hdfs.yml
[root@wytest test]# cat hadoop-hdfs.yml
version: '2'
services:
namenode:
image: singularities/hadoop
command: start-hadoop namenode
hostname: namenode
environment:
HDFS_USER: hdfsuser
ports:
- "8020:8020"
- "14000:14000"
- "50070:50070"
- "50075:50075"
- "10020:10020"
- "13562:13562"
- "19888:19888"
datanode:
image: singularities/hadoop
command: start-hadoop datanode namenode
environment:
HDFS_USER: hdfsuser
links:
- namenode
[root@wytest test]# docker-compose up -d
ERROR: Cannot extend service 'datanode' in /makswy/wy-docker-compose/test/hadoop-hdfs.yml: services with 'links' cannot be extended
报错的意思好像是:links不用这种扩展方式使用,只能直接在docker-compose.yml文件里使用,其实我搞不懂,这里为什么要用,本来docker-compose里的所有服务都同一个网络下了。
解决方法:
第一:把namenode和datanode两个服务直接写在docker-compose.yml文件里
第二:把links删除不用。
另:depends_on的意思是datanode启动前,要等namenode启动起来。两者依赖关系,其实这里不用也可以。
更多推荐
已为社区贡献3条内容
所有评论(0)