Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FrancoStino/501e10d4ee966f30407f6ddd2d7a4e30 to your computer and use it in GitHub Desktop.
Save FrancoStino/501e10d4ee966f30407f6ddd2d7a4e30 to your computer and use it in GitHub Desktop.
Stops and starts a Docker container using the systemctl command, starting with docker mode for debugging.

Docker Engine Stop and Start Commands - Linux

Preview:
# Check if docker engine is active and stop or start accordingly
if systemctl is-active --quiet docker; then
    sudo systemctl stop docker
else
    sudo systemctl start docker
fi
Associated Context
Type Code Snippet ( .sh )
Associated Tags Systemctl Stop Docker Start Command Line Interface Linux Commands Containerization Service Windows Management Shell Execution Environment Variables User Interaction (UI) Framework: None systemctl docker start stop
💡 Smart Description Stops and starts a Docker container using the systemctl command, starting with docker mode for debugging.
Use systemctl commands to stop and start the Docker service on a Linux system.
🔎 Suggested Searches How to stop Docker in Linux using systemctl?
Related Links https://www.geeksforgeeks.org/
https://www.geeksforgeeks.org/cd-command-in-linux-with-examples/
https://www.geeksforgeeks.org/uname-command-in-linux-with-examples/
https://linuxize.com/post/how-to-remove-docker-images-containers-volumes-and-networks/
https://linuxize.com/post/how-to-install-and-use-docker-compose-on-ubuntu-18-04/
https://docs.docker.com/engine/reference/commandline/restart/
https://docs.docker.com/config/daemon/systemd/
Related People Davide Ladisa
Sensitive Information No Sensitive Information Detected
Shareable Link https://davideladisa.pieces.cloud/?p=fdba4e9856
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment