Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker compose ignores my Dockerfile when I use the build command

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.

like image 745
JSBach Avatar asked Jan 26 '16 20:01

JSBach


2 Answers

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

like image 140
Vaidas Lungis Avatar answered Nov 15 '22 09:11

Vaidas Lungis


Before you type docker-compose up, you should build images with docker-compose build [options] [SERVICE...].

Options:
--force-rm  Always remove intermediate containers.
--no-cache  Do not use cache when building the image.
--pull      Always attempt to pull a newer version of the image.

In your case, ex: docker-compose build --no-cache web

like image 28
Sergey Zhuk Avatar answered Nov 15 '22 10:11

Sergey Zhuk