docker-compose oci运行时错误可执行文件未find(在链接的容器中)

我正在尝试设置docker&compose来运行集成testing

我有以下docker-compose.yml

version: '3' services: tests: build: context: . dockerfile: Dockerfile.tests links: - web - maindb web: build: context: . dockerfile: Dockerfile.web ports: - "8080:8080" volumes: - .:/code - logvolume01:/var/log links: - maindb maindb: image: postgres environment: POSTGRES_PASSWORD: example volumes: logvolume01: {} 

Web容器本身工作得很好

 $ docker-compose -p wh run web Starting wh_maindb_1 ... done 2017/07/27 22:05:34 [I] http server Running on http://:8080 

但是当我运行testing容器,我得到的错误

 $ docker-compose -p wh run tests Starting wh_maindb_1 ... done Starting 6faff07f7671_6faff07f7671_wh_web_1 ... Starting 6faff07f7671_6faff07f7671_wh_web_1 ... error ERROR: for 6faff07f7671_6faff07f7671_wh_web_1 Cannot start service web: oci runtime error: container_linux.go:262: starting container process caused "exec: \"web\": executable file not found in $PATH" 

这是我的Dockerfile.web

 $ cat Dockerfile.web FROM ubuntu:xenial WORKDIR /app ADD bin/* /app/ CMD ["/app/web"] 

/ app / web是用Golang 1.6编写的dynamic链接守护进程

和一些版本信息

 $ docker version Client: Version: 17.06.0-ce API version: 1.30 Go version: go1.8.3 Git commit: 02c1d87 Built: Fri Jun 23 21:23:31 2017 OS/Arch: linux/amd64 Server: Version: 17.06.0-ce API version: 1.30 (minimum version 1.12) Go version: go1.8.3 Git commit: 02c1d87 Built: Fri Jun 23 21:19:04 2017 OS/Arch: linux/amd64 Experimental: false $ docker-compose version docker-compose version 1.14.0, build c7bdf9e docker-py version: 2.4.2 CPython version: 2.7.12 OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016 

这可能与一些docker-compose bug有关。

尝试清洗容器

 docker-compose down 

或者这(你将失去你的容器数据):

 docker rm -f $(docker ps -a -q)