
Let us take a look at how to stop and start a docker container,
First let's create a container using the docker run command,
% docker run -id --name my_alpine alpine
a7fdf87c9868281057018c20cbfcaa0c8108214b4f2a151ff9f22d8627774c38
Let's see the details of the running docker containers using the docker ps command,
% docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a7fdf87c9868 alpine "/bin/sh" 53 seconds ago Up 52 seconds my_alpine
Stop a docker Container
To stop a docker container make use of the command docker stop followed by the CONTAINER ID or the name of the docker container,
Example:% docker stop my_alpine
my_alpine
Let's see if got stopped with the docker ps command again, but this time with a -a option,
% docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a7fdf87c9868 alpine "/bin/sh" 24 minutes ago Exited (137) 1 minutes ago my_alpine
Start a Start a stopped Docker Container
As you may have guessed we can start a stopped/exited container using docker start <container_name or id>
% docker start a7fdf87c9868
a7fdf87c9868
% docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a7fdf87c9868 alpine "/bin/sh" 28 minutes ago Up 2 minutes my_alpine
Have Questions? Post them here!
- How to docker remove a container when it exits
- Install Python on Alpine Linux - Docker
- How to Rename Docker Image with none TAG and REPOSITORY?
- Remove all stopped containers in Docker using prune command
- [Fix] Docker Error response from daemon: manifest for :latest not found: manifest unknown
- [fix] Error response from daemon: conflict unable to remove repository reference ubuntu container is using its referenced image
- [Docker] Install Python3 on Alpine Linux
- Unable to find image docker latest locally
- How to Stop/Cancel/kill docker image pull
- How to know the Docker Engine Version
- [fix] Docker: OCI runtime exec failed unable to start container process
- [Solution] Alpine Docker apt-get: not found
- Install and Run Cassandra on Docker Desktop
- Install node on Alpine Linux Docker
- How to Copy files from Docker Container to Host System
- Install the minimal Linux on Docker (only 5 mb Alpine Linux)
- How to stop and start a docker container
- Docker - Error response from daemon: You cannot remove a running container
- Open Docker Desktop from macOS Terminal
- How to check installed docker version command
- How to know the Docker Sandbox ID of a Container Network?
- [fix] docker: Error response from daemon: dial unix docker.raw.sock: connect: no such file or directory.
- [Docker] Install Git on Alpine Linux
- Docker MySQL Compose File with Volume Example
- [fix] Docker: Alpine Linux - /bin/sh: bash: not found
- [Fix] Modern authentication failed here, but youll still be able to sign in. Your status code is 4c7 - Microsoft Teams - Teams
- Download Google Chrome setup exe file using PowerShell - Powershell
- Cannot load PowerApps form in SharePoint Online due to repeated authentication - SharePoint
- [Java] NoClassDefFoundError Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory - Java
- Truncate table using Java JDBC Example - Java
- Gradle FAILURE: Build failed with an exception - Task not found in root project - Gradle
- How to Select All text in vim/vi editor using Keyboard - Linux
- Display full website URL/address in Safari macOS Browser - MacOS