Config Router

  • Google Sheets
  • CCNA Online training
    • CCNA
  • CISCO Lab Guides
    • CCNA Security Lab Manual With Solutions
    • CCNP Route Lab Manual with Solutions
    • CCNP Switch Lab Manual with Solutions
  • Juniper
  • Linux
  • DevOps Tutorials
  • Python Array
You are here: Home / Linux / Stop a Docker Container

Stop a Docker Container

May 13, 2020 by James Palmer

Stop a docker container: 

The docker engine provides a stop option which can be used to stop the execution of a container which is in running state.

The syntax is as follows:
# docker stop <CONTAINER-NAME | CONTAINER-NAME ID
[email protected]:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
33de85aaf61c 9a0b6e4f0956 “sh” 6 months ago Up About an hour do_nothing_container

Now we use the stop option to stop the running container.
[email protected]:~$ sudo docker stop do_nothing_container
do_nothing_container
The other arguments stop option accepts in –time or -t which stops the container in specified amount of time in seconds.
[email protected]:~$ sudo docker -v stop -t 20 do_nothing_container
do_nothing_container
[email protected]:~$ sudo docker ps -a | grep do_nothing
33de85aaf61c 9a0b6e4f0956 “sh” 6 months ago Exited (137) About a minute ago do_nothing_container

Once the command is typed the cli goes into non-interactive mode till the times expires and finally returns back after the container is successfully stopped; The container is killed and moved to the stopped state.

You can also read Managing Dock Disk Space

Related

Filed Under: Linux

Recent Posts

  • How do I give user access to Jenkins?
  • What is docker volume command?
  • What is the date format in Unix?
  • What is the difference between ARG and ENV Docker?
  • What is rsync command Linux?
  • How to Add Music to Snapchat 2021 Android? | How to Search, Add, Share Songs on Snapchat Story?
  • How to Enable Snapchat Notifications for Android & iPhone? | Steps to Turn on Snapchat Bitmoji Notification
  • Easy Methods to Fix Snapchat Camera Not Working Black Screen Issue | Reasons & Troubleshooting Tips to Solve Snapchat Camera Problems
  • Detailed Procedure for How to Update Snapchat on iOS 14 for Free
  • What is Snapchat Spotlight Feature? How to Make a Spotlight on Snapchat?
  • Snapchat Hack Tutorial 2021: Can I hack a Snapchat Account without them knowing?

Copyright © 2023 · News Pro Theme on Genesis Framework · WordPress · Log in