每当我运行此命令docker-compose up -d
时,都会遇到无法解决的错误。
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 24, in <module>
from ..config import ConfigurationError
File "/usr/local/lib/python2.7/dist-packages/compose/config/__init__.py", line 6, in <module>
from .config import ConfigurationError
File "/usr/local/lib/python2.7/dist-packages/compose/config/config.py", line 51, in <module>
from .validation import match_named_volumes
File "/usr/local/lib/python2.7/dist-packages/compose/config/validation.py", line 12, in <module>
from jsonschema import Draft4Validator
File "/usr/local/lib/python2.7/dist-packages/jsonschema/__init__.py", line 11, in <module>
from jsonschema.exceptions import (
File "/usr/local/lib/python2.7/dist-packages/jsonschema/exceptions.py", line 152, in <module>
@attr.s(hash=True)
AttributeError: 'module' object has no attribute 's'
答案 0 :(得分:1)
要运行docker-compose命令,您必须定义docker-compose.yml文件并指定将使用您的Dockerfile的服务。您无法在Dockerfile上执行docker-compose
docker-compose文件的简单示例
version: "3.8"
services:
web:
build: .
ports:
- "5000:5000"
build选项允许您指定Dockerfile所在的上下文。
这里是文档的链接 getting started