• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Search

stop

Stop and remove all Docker containers

December 11, 2021

How to stop and remove all Docker containers.

Stop all containers

$ docker kill $(docker ps -q)

$ docker kill $(docker ps -q)

Remove all containers

$ docker rm $(docker ps -a -q)

$ docker rm $(docker ps -a -q)

Delete all docker images

$ docker rmi $(docker images -q)

$ docker rmi $(docker images -q)

Filed Under: Linux Tagged With: containers, delete, docker, images, remove, stop

Migrate VM to Other Network

July 20, 2021

Here’s how to move a VM to another network.

Stop the VM.

gcloud compute instances stop server-name \
--zone=us-central1-c \
--project project-id

gcloud compute instances stop server-name \ --zone=us-central1-c \ --project project-id

Migrate the VM. Use self link for network and subnetwork.

gcloud compute instances network-interfaces update server-name \
--zone=us-central1-c \
--network-interface=nic0 \
--network=your-network \
--subnetwork=your-sub-network \
--project project-id

gcloud compute instances network-interfaces update server-name \ --zone=us-central1-c \ --network-interface=nic0 \ --network=your-network \ --subnetwork=your-sub-network \ --project project-id

Start the VM.

gcloud compute instances start server-name \
--zone=us-central1-c \
--project project-id

gcloud compute instances start server-name \ --zone=us-central1-c \ --project project-id

Filed Under: Cloud Tagged With: compute, gcloud, gcp, instance, move, network, network-interface, start, stop

GCP Rename VM

July 16, 2021

There’s a new beta command to rename a GCP VM.

You must stop instance first.

gcloud compute instances stop server-name \
--zone us-central1-c \
--project your-project-id

gcloud compute instances stop server-name \ --zone us-central1-c \ --project your-project-id

Rename the instance.

gcloud beta compute instances set-name old-server-name \
--new-name=new-server-name \
--zone us-central1-c \
--project your-project-id

gcloud beta compute instances set-name old-server-name \ --new-name=new-server-name \ --zone us-central1-c \ --project your-project-id

Start the instance.

gcloud compute instances start server-name \
--zone us-central1-c \
--project your-project-id

gcloud compute instances start server-name \ --zone us-central1-c \ --project your-project-id

Login.

gcloud compute ssh server-name \
--zone us-central1-c \
--project your-project-id \
--internal-ip &

gcloud compute ssh server-name \ --zone us-central1-c \ --project your-project-id \ --internal-ip &

Filed Under: Cloud Tagged With: gcp, instance, rename, set-name, stop, vm

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 5
  • Go to Next Page »
  • Home
  • About
  • Search

Copyright © 2023