添加狮身人面像容器docker-compose显示错误

我有一个Ruby on Rails项目,我想放入容器(有数据库,redis和web(包括rails项目)容器)。 我想添加searchfunction,所以我在撰写文件docker-compose.yml中添加了一个sphinx容器

web: dockerfile: Dockerfile-rails build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' ports: - "3000:3000" links: - redis - db **- sphinx** environment: - REDISTOGO_URL=redis://user@redis:6379/ redis: image: redis **sphinx: image: centurylink/sphinx** db: dockerfile: Dockerfile-db build: . env_file: .env_db 

docker-compose build工作正常,但是当我运行docke-compose up我得到ERROR: Cannot start container 096410dafc86666dcf1ffd5f60ecc858760fb7a2b8f2352750f615957072d961: Cannot link to a non running container: /metartaf_sphinx_1 AS /metartaf_web_1/sphinx_1我该如何解决这个问题?

根据https://hub.docker.com/r/centurylink/sphinx/的Sphinx容器运行需要一定数量的configuration文件才能正常运行。 请参阅*守护进程的使用(2)。 您需要数据源文件和configuration。

在我的testing中,它无法启动,因为有错误:

 FATAL: no readable config file (looked in /usr/local/etc/sphinx.conf, ./sphinx.conf) 

docker-compose.yml不应该包含这些*

如果你想要狮身人面像最新版本,你可以这样做:

 web: dockerfile: Dockerfile-rails build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' ports: - "3000:3000" links: - redis - db - sphinx environment: - REDISTOGO_URL=redis://user@redis:6379/ redis: image: redis sphinx: image: centurylink/sphinx:latest db: dockerfile: Dockerfile-db build: . env_file: .env_db 

如果你想要一个特定的版本,你可以这样写: centurylink/sphinx:2.1.8