本文介绍了当我使用build命令时,Docker组合忽略了我的Docker文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个文件夹结构:



/ home / me / composetest
/ home / me / composetest / mywildflyimage



内部复合材料我有这个docker-compose.yml:

  web:
image: test / mywildfly
container_name:wildfly
ports:
- 8080:8080
- 9990:9990

Inside mywildflyimage我有这个码头图像:

  FROM jboss / wildfly 

EXPOSE 8080 9990

添加standalone.xml / opt / jboss / wildfly / standalone / configuration /

RUN / opt / jboss / wildfly /bin/add-user.sh admin admin --silent
CMD [/opt/jboss/wildfly/bin/standalone.sh,-b,0.0.0.0,-bmanagement, 0.0.0.0]

如果我运行



docker build -t test / mywildfly。


docker-composs up

一切运行良好,管理部分注意到0.0。 0.0(-bmanagement 0.0.0.0部分的CMD命令)。



如果我更改docker-compose.yml:

  web:
build:mywildflyimage
container_name:wildfly
ports:
- 8080:8080
- 9990:9990

并运行
docker-compose up



它仍然启动,但管理员部分不再绑定到0.0.0.0(这是我继承的图像的默认行为)。



为什么在docker-compose.ml中使用 build 命令时,它会停止工作?



编辑:似乎忽略了所有的docker文件命令。

解决方案

运行 docker-compose更改docker-comopse.yml后,再修改,然后 docker-compise up


I have this folder structure:

/home/me/composetest/home/me/composetest/mywildflyimage

Inside composites I have this docker-compose.yml:

web:
    image: test/mywildfly
    container_name: wildfly
    ports:
        - "8080:8080"
        - "9990:9990"

Inside mywildflyimage I have this docker image:

FROM jboss/wildfly

EXPOSE 8080 9990

ADD standalone.xml /opt/jboss/wildfly/standalone/configuration/

RUN /opt/jboss/wildfly/bin/add-user.sh admin admin --silent
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"]

If i run

docker built -t test/mywildfly .
docker-compose up

Everything works great, and the management part is minded to 0.0.0.0 (-bmanagement 0.0.0.0 part of the CMD command).

If I change my docker-compose.yml:

web:
        build: mywildflyimage
        container_name: wildfly
        ports:
            - "8080:8080"
            - "9990:9990"

and run docker-compose up

It still boots, but the admin part is not bound to 0.0.0.0 anymore (this is the default behaviour for the image I inherited from).

Why does it stop working when I use the build command in the docker-compose.ml?

EDIT: It seems that it is ignoring all my docker file commands.

解决方案

run docker-compose build after changing docker-comopse.yml and then docker-compose up

这篇关于当我使用build命令时,Docker组合忽略了我的Docker文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 17:27