我目前正在Debian 8.2服务器上测试docker,我正在向有经验的人寻求帮助。
我按照官方文档安装了docker(http://docs.docker.com/installation/debian/),现在我正在尝试使用docker compose(https://docs.docker.com/compose/)。 我在官方文档中描述了使用pip安装compose(“pip install -U docker-compose”)
运行“docker-compose”会给我一个帮助屏幕,但是“docker-compose up”不起作用并且给我带来很多错误。
有关如何使其工作的任何想法? 我错过了什么吗?一个先决条件可能是?
root@server:~/dockerfiles/compose-test# docker-compose up
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 39, in main
command.sys_dispatch()
File "/usr/local/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch
self.dispatch(sys.argv[1:], None)
File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 27, in dispatch
super(Command, self).dispatch(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 24, in dispatch
self.perform_command(*self.parse(argv, global_options))
File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 57, in perform_command
verbose=options.get('--verbose'))
File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 73, in get_project
config_details = config.find(self.base_dir, config_path)
File "/usr/local/lib/python2.7/dist-packages/compose/config.py", line 107, in find
return ConfigDetails(load_yaml(filename), os.path.dirname(filename), filename)
File "/usr/local/lib/python2.7/dist-packages/compose/config.py", line 558, in load_yaml
return yaml.safe_load(fh)
File "/usr/local/lib/python2.7/dist-packages/yaml/__init__.py", line 93, in safe_load
return load(stream, SafeLoader)
File "/usr/local/lib/python2.7/dist-packages/yaml/__init__.py", line 71, in load
return loader.get_single_data()
File "/usr/local/lib/python2.7/dist-packages/yaml/constructor.py", line 37, in get_single_data
node = self.get_single_node()
File "/usr/local/lib/python2.7/dist-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/usr/local/lib/python2.7/dist-packages/yaml/composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "/usr/local/lib/python2.7/dist-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/usr/local/lib/python2.7/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
while not self.check_event(MappingEndEvent):
File "/usr/local/lib/python2.7/dist-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/usr/local/lib/python2.7/dist-packages/yaml/parser.py", line 428, in parse_block_mapping_key
if self.check_token(KeyToken):
File "/usr/local/lib/python2.7/dist-packages/yaml/scanner.py", line 116, in check_token
self.fetch_more_tokens()
File "/usr/local/lib/python2.7/dist-packages/yaml/scanner.py", line 220, in fetch_more_tokens
return self.fetch_value()
File "/usr/local/lib/python2.7/dist-packages/yaml/scanner.py", line 580, in fetch_value
self.get_mark())
yaml.scanner.ScannerError: mapping values are not allowed here
in "./docker-compose.yml", line 3, column 8
root@server:~/dockerfiles/compose-test#
我正在运行docker 1.8.2并撰写1.4.2
答案 0 :(得分:0)
使用curl安装docker compose对我有用:
sudo apt-get install curl
sudo curl -L https://github.com/docker/compose/releases/download/1.4.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
答案 1 :(得分:0)
我已经手动拉出图像,而不是在运行docker-compose.yml
时拉出图像。当我运行docker-compose.yml
时,它起作用了。