YouTip LogoYouTip

Docker Start Stop Restart Command

docker start/stop/restart Commands |

-- Learning not just technology, but dreams!

Docker Tutorial

Docker Tutorial Docker Concepts Docker Architecture

Docker Installation

Docker Desktop Ubuntu Docker Installation Debian Docker Installation CentOS Docker Installation Windows Docker Installation MacOS Docker Installation Docker Mirror Acceleration

Docker Usage

Docker Hello World Docker Container Usage Docker Image Usage Docker Container Connection Docker Repository Management Docker Dockerfile Docker Compose Docker Machine Swarm Cluster Management

Docker Examples

Docker Install Ubuntu Docker Install Centos Docker Install Nginx Docker Install Node.js Docker Install PHP Docker Install MySQL Docker Install Tomcat Docker Install Python Docker Install Redis Docker Install MongoDB Docker Install Apache

Docker Reference Manual

Docker Command Manual Docker Resources Summary

Docker Install Apache

Docker Resources Summary

docker start/stop/restart Commands

Docker Command ManualDocker Command Manual


docker start command is used to start one or more already created containers.

docker stop command is used to stop a running container.

docker restart command is used to restart a container.


docker start Command

Syntax

docker start  CONTAINER [CONTAINER...]

Parameters

  • -a: Attach to the container's standard input/output streams.
  • -i: Attach and keep standard input open.

Examples

Start a container:

docker start my_container

Starts the container named my_container.

Start and attach to a container:

docker start -a my_container

Starts the container and attaches to its standard input/output streams.

Start multiple containers simultaneously:

docker start container1 container2 container3

Starts containers container1, container2, and container3 simultaneously.


docker stop Command

Syntax

docker stop  CONTAINER [CONTAINER...]

Parameters

-t, --time: Seconds to wait before stopping the container, default is 10 seconds.

Examples

Stop a container:

docker stop my_container

Stops the container named my_container.

Stop a container with a specified wait time:

docker stop -t 30 my_container

Stops the container after waiting 30 seconds.

Stop multiple containers simultaneously:

docker stop container1 container2 container3

Stops containers container1, container2, and container3 simultaneously.


docker restart Command

Syntax

docker restart  CONTAINER [CONTAINER...]

Parameters

-t, --time: Seconds to wait before restarting the container, default is 10 seconds.

Examples

Restart a container:

docker restart my_container

Restarts the container named my_container.

Restart a container with a specified wait time:

docker restart -t 15 my_container

Restarts the container after waiting 15 seconds.

Restart multiple containers simultaneously:

docker restart container1 container2 container3

Restarts containers container1, container2, and container3 simultaneously.


Docker Command ManualDocker Command Manual

Docker Install Apache

Docker Resources Summary

← Prop Element OffsetheightBootstrap5 Offcanvas β†’