--squash
option in docker-compose when building a new docker images? Right now they have implemented --squash
in docker as of 6 months ago, but I have not seen any docs about how to use this in docker-compose.yml.--squash
, you can use Docker multi-stage builds.Dockerfile
:--target
flag for docker build
. The argument of --target
should name the name of the image after the AS
keyword in the Dockerfile.docker build --target base --tag base .
docker build --target testing --tag testing .
docker build --target documentation --tag documentation .
docker-compose.yml
, you can use the target
keyword in your YAML. docker-compose.yml
file that references the Dockerfile
above:docker-compose build
using this docker-compose.yml
, it will build the testing
and documentation
images in the Dockerfile
. As with any other docker-compose.yml
, you can also add ports, environment variables, runtime commands, and so on.4bb15f3b6977
.jboss/wildfly:latest
image: