YouTip LogoYouTip

Docker Compose Restart Command

Docker Compose Restart Command | Tutorial

Docker Compose Restart Command | Tutorial

-- Learn more than just technology, learn your dreams!

Docker Tutorial

Docker Installation

Docker Usage

Docker Instances

Docker Reference Manual

Docker Compose Restart Command

Image 3: Docker Command Manual

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

This command stops the running service containers and then restarts them.

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

Syntax

docker compose restart [SERVICE...]
  • SERVICE (optional): Can specify one or more service names to restart. If no service name is specified, all services defined in the docker-compose.yml file will be restarted.

Examples

  1. Restart all services:
  2. docker-compose restart
  3. Restart specific services (e.g., web and db services):
  4. docker-compose restart web db

    Ensure you execute these commands in the directory containing the docker-compose.yml file, or use the -f parameter to specify the location of the docker-compose.yml file. 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 allows you to control which docker-compose.yml file is used to manage the services.

Image 4: Docker Command Manual

← Linux Shell Io RedirectionsLinux Shell Func β†’