英文:
docker-compose oci runtime error executable file not found (in linked container)
问题
我正在尝试设置Docker和Compose以运行集成测试。
我有以下的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
但是当我运行tests容器时,我遇到了错误:
$ 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
希望对你有所帮助!
英文:
I'm trying to setup docker & compose for running integration tests
I have the following 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 container itself works pretty fine
$ docker-compose -p wh run web
Starting wh_maindb_1 ... done
2017/07/27 22:05:34 [I] http server Running on http://:8080
But when I run tests container, I get the error
$ 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"
Here is my Dockerfile.web
$ cat Dockerfile.web
FROM ubuntu:xenial
WORKDIR /app
ADD bin/* /app/
CMD ["/app/web"]
/app/web is dynamically linked daemon written in Golang 1.6
And some version info
$ 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
答案1
得分: 0
这可能与一些docker-compose的bug有关。
尝试清理容器:
docker-compose down
或者使用以下命令(这将删除容器数据):
docker rm -f $(docker ps -a -q)
英文:
This is maybe related to some docker-compose bug.
Try cleaning containers
docker-compose down
Alternatively this (you will lose your container data):
docker rm -f $(docker ps -a -q)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论