我有一个撰写文件,可以使用docker-compose命令运行
m-c02wt0e3htdg:arquillian-cub r0s0164 $ docker-compose -f docker_compose.yml up -d
使用默认驱动程序创建网络“ arquillian-cub_default”
创建arquillian-cub_fake_1 ...完成
创建arquillian-cub_tomcat_1 ...完成
m-c02wt0e3htdg:arquillian-cub r0s0164 $ docker容器ls 容器ID图像命令创建的状态端口名称 ef8693bc7006 tutum / tomcat:7.0“ /run.sh” 10秒前提升9秒0.0.0.0:8181->8080/tcp arquillian-cub_tomcat_1
8b11de635750 cicd / my-fake-service:latest“ java -cp app:app / li ...” 10秒前上9秒8081-8082 / tcp,0.0.0.0:9191->8080/tcp arquillian-cub_fake_1 < / p>
m-c02wt0e3htdg:arquillian-cub r0s0164 $ curl -I http://localhost:8181 HTTP / 1.1 200 OK 伺服器:Apache-Coyote / 1.1 内容类型:text / html; charset = ISO-8859-1 传输编码:分块 日期:2018年12月11日,星期二06:01:25 GMT
m-c02wt0e3htdg:arquillian-cub r0s0164 $ curl -I http://localhost:9191 HTTP / 1.1 404 内容类型:application / json; charset = UTF-8 传输编码:分块 日期:星期二,2018年12月11日06:01:35 GMT
我在arquillian.xml中指定的相同docker-compose文件
<?xml version="1.0" encoding="UTF-8"?>
<arquillian
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<extension qualifier="docker">
<property name="serverVersion">1.30</property>
<property name="definitionFormat">COMPOSE</property>
<property name="dockerContainersFile">docker_compose.yml</property>
</extension>
</arquillian>
控制台:
CubeDockerConfiguration:
serverVersion = 1.30
serverUri = unix:///var/run/docker.sock
tlsVerify = false
dockerServerIp = localhost
definitionFormat = COMPOSE
clean = false
removeVolumes = true
dockerContainers = containers:
tomcat:
alwaysPull: false
image: tutum/tomcat:7.0
killContainer: false
manual: false
networkMode: arquillian-cub_default
networks: [arquillian-cub_default]
portBindings: !!set {8181->8080/tcp: null}
readonlyRootfs: false
removeVolumes: true
fake:
alwaysPull: false
exposedPorts: !!set {8082/tcp: null}
image: cicd/my-fake-service:latest
killContainer: false
manual: false
networkMode: arquillian-cub_default
networks: [arquillian-cub_default]
portBindings: !!set {9191->8080/tcp: null}
readonlyRootfs: false
removeVolumes: true
networks:
arquillian-cub_default:{驱动程序:桥}
运行测试时出现错误:
原因:java.lang.IllegalArgumentException:没有指定端口,并且在所有容器中都有多个绑定端口。 在org.arquillian.cube.docker.impl.util.SinglePortBindResolver.resolvePortBindPort(SinglePortBindResolver.java:161)
希望对此有所帮助。我知道我在这里错过了一些东西