我正在尝试设置docker&撰写运行集成测试
我有以下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
但是当我运行测试容器时,我收到错误
$ 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编写的动态链接守护进程
以及一些版本信息
$ 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
答案 0 :(得分:0)
这可能与某些docker-compose bug有关。
尝试清洁容器
docker-compose down
或者这个(你将丢失容器数据):
docker rm -f $(docker ps -a -q)