Cookie Consent by Free Privacy Policy Generator ๐Ÿ“Œ The Most Useful Docker Commands for Mac Youโ€™ve Never Heard of, Because You Need To Make Them

๐Ÿ  Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeitrรคge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden รœberblick รผber die wichtigsten Aspekte der IT-Sicherheit in einer sich stรคndig verรคndernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch รผbersetzen, erst Englisch auswรคhlen dann wieder Deutsch!

Google Android Playstore Download Button fรผr Team IT Security



๐Ÿ“š The Most Useful Docker Commands for Mac Youโ€™ve Never Heard of, Because You Need To Make Them


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

The commands are:

  • docker open - Open Docker Desktop (and therefore start the docker daemon) from your terminal.

  • docker close - Close Docker Desktop (and therefore stop the docker daemon) from your terminal.

  • docker flush - Stop and remove all running and stopped containers.

How Do We Get There?

With a simple function written for Zsh which is provided below.

docker() {
    case "$1" in
        "open")
            echo "Opening the Docker app..."
            open --background -a Docker
            ;;
        "close")
            echo "Stopping currently running Docker containers..."
            command docker ps -q | xargs -r -L1 command docker stop
            if [ $? -eq 0 ]; then
                echo "Closing the Docker app..."
                test -z "$(command docker ps -q 2>/dev/null)" && osascript -e 'quit app "Docker"'
            else
                echo "Failed to stop containers."
            fi
            ;;
        "flush")
            echo "Stopping and removing all containers."
            command docker container stop $(command docker ps -a -q) && command docker container rm $(command docker ps -a -q)
            if [ $? -eq 0 ]; then
                echo "Done."
            else
                echo "Failed to flush containers."
            fi
            ;;
        *)
            command docker "$@"
            ;;
    esac
}

To make the commands detailed earlier accessible in your terminal, incorporate them into your Zsh configuration. This can be achieved by appending the script to your ~/.zshrc file. Alternatively, you can add it to another file that ~/.zshrc sources. Begin by opening the ~/.zshrc file located in your home directory with your preferred text editor. Then, simply copy and paste the script to the end of this file.

But Why Though?

I've saved this section for last because I assume that if you've found your way here, you likely have your own reasons for seeking out such functionality.

However, mine started back when I was working on a less powerful Macbook Air back in 2019 or so. I didn't want to run Docker Desktop in the background all of the time, but I wanted an easy way to start and stop the Docker daemon from the terminal.

Additionally, sometimes I wanted to bring down a project spun up by docker compose, but I didn't necessarily want to change directories to the project where the docker-compose.yml file was.

While these might seem like trivial issues, I've been pleasantly surprised by the significant utility these commands have provided over the years. I wanted to share them in the hope they might be useful to others.

...



๐Ÿ“Œ The Most Useful Docker Commands for Mac Youโ€™ve Never Heard of, Because You Need To Make Them


๐Ÿ“ˆ 113.32 Punkte

๐Ÿ“Œ A useful Android privacy feature that most people have never heard of


๐Ÿ“ˆ 48.15 Punkte

๐Ÿ“Œ Never Heard of People Data Labs? They've Heard of You, Likely Have Your Data and It Was Exposed in a Breach


๐Ÿ“ˆ 47.75 Punkte

๐Ÿ“Œ The Most Useful Linux Commands You Probably Need to Know


๐Ÿ“ˆ 41.19 Punkte

๐Ÿ“Œ Mac Terminal Commands You Need to Know to Master the Useful Tool


๐Ÿ“ˆ 39.25 Punkte

๐Ÿ“Œ GIFCT : Possibly the Most Important Acronym Youโ€™ve Never Heard Of


๐Ÿ“ˆ 38.01 Punkte

๐Ÿ“Œ The most promising AI smart glasses are from a brand you've never heard of


๐Ÿ“ˆ 38.01 Punkte

๐Ÿ“Œ Drivers? Never Heard of Them, Says Uber


๐Ÿ“ˆ 36.9 Punkte

๐Ÿ“Œ You should know how to make custom commands! Its very simple and insanely useful!!


๐Ÿ“ˆ 34.11 Punkte

๐Ÿ“Œ How do you make somebody a moderator & What are mod commands and how do you use them(on twitch)


๐Ÿ“ˆ 32.86 Punkte

๐Ÿ“Œ Useful Vim Plugins You Haven't Heard Of


๐Ÿ“ˆ 32.72 Punkte

๐Ÿ“Œ Unix Commands Cheat Sheet: All the Commands You Need


๐Ÿ“ˆ 32.49 Punkte

๐Ÿ“Œ Videos : My most used/useful Linux commands


๐Ÿ“ˆ 31.58 Punkte

๐Ÿ“Œ A Guide to the Most Useful AWS EKS Commands


๐Ÿ“ˆ 31.58 Punkte

๐Ÿ“Œ You weren't hacked because you lacked space-age network defenses. Nor because cyber-gurus picked on you. It's far simpler than that


๐Ÿ“ˆ 31.26 Punkte

๐Ÿ“Œ Controversial PEPs You (Probably) Never Heard Of


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ Meet the Magecart hackers, a persistent credit card skimmer group of groups youโ€™ve never heard of


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ Microsoft Updates SwiftKey Keyboard with Languages Youโ€™ve Never Heard About


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ io_submit: The epoll alternative you've never heard about


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ Five female technoheroes you might never have heard ofโ€ฆ


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ You've Never Heard of THESE Operating Systems


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ Reviving the coolest scanner youโ€™ve never heard of


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ Reviving the coolest scanner youโ€™ve never heard of


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ RisiOS is the Fedora-based Linux distribution you've never heard of but should definitely try


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ Microsoft Edge's Sidebar is the best browser feature you've never heard of


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ WinMoHyves โ€“ a Windows Mobile client for the biggest social network you have never heard of


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ Cisco Spotlights New IT Roles You May Have Never Heard of


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ A question you've never heard before! What distro should I choose?


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ ThinPro OS by HP -- a vendor-specific linux distro that you never heard of


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ 15 Killer ๐Ÿ—ก JS techniques you've probably never heard of ๐Ÿ”ˆ๐Ÿ”ฅ


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ Is this the best laptop you've never heard of?


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ I bet you've never heard of this feature Microsoft will cut from Windows 11


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ I'll never understand how people live without snapshots. Kids, have you heard the good news of snapshots?


๐Ÿ“ˆ 30.85 Punkte

๐Ÿ“Œ Earthsounds trailer: Youโ€™ve never heard nature like this


๐Ÿ“ˆ 30.85 Punkte











matomo