Using Compose, if I run docker-compose build
, it will rebuild all the containers :
> docker-compose build
Building elasticsearch
Yes, use the name of the service:
docker-compose build elasticsearch
docker-compose up -d --no-deps --build <service_name>
Source
if you want to run and recreate a specific service inside your docker-compose file you can do it the same way as @dnephin proposed, like
$ docker-compose up -d --force-recreate --no-deps --build service_name
Suppose your docker-compose.yml file is like
version: '3'
services:
service_1:
.....
service_2:
.....
You have do do it manually using image tag. More details here.