gpt-4o-2024-08-06· OpenAI
WildChat-4.8M (AI2)
docker restart
- User
docker restart
- Assistant
The
docker restartcommand is used to restart one or more running containers. When you restart a container, Docker stops it and then starts it again.The basic syntax for the command is:
bashdocker restart [OPTIONS] CONTAINER [CONTAINER...]Here
CONTAINERcan be the container name or the container ID. You can specify multiple containers separated by a space if you want to restart more than one container at a time.Options
-t,--time: Specify a shutdown timeout in seconds. Docker will wait for this duration before forcefully stopping the container. The default is 10 seconds. For example, use--time 30to allow the container 30 seconds to shut down gracefully.
Examples
-
Restart a single container by name:
bashdocker restart my_container