Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

docker compose restart command

docker compose restart command

Docker Command ReferenceDocker Command Reference


The docker compose restart command is used to restart one or more services.

The docker compose restart command stops the running service containers and then starts them again.

If you need to update the configuration or just want to simply restart a service without rebuilding the container, restart is very useful.

Syntax

docker compose restart [SERVICE...]

Example

1. Restart all services:



docker-compose restart

2. Restart specific services (for example, services named web and db):



docker-compose restart web db

Make sure you run these commands in the directory containing the docker-compose.yml file, or specify the location of the docker-compose.yml file with the -f argument. For example, if your docker-compose.yml file is not in the current directory, you can specify the file location like this:



docker-compose -f /path/to/docker-compose.yml restart

This lets you control which docker-compose.yml file is used to manage services.


Docker Command ReferenceDocker Command Reference