How to stop and remove all Docker containers.
Stop all containers
$ docker kill $(docker ps -q) |
Remove all containers
$ docker rm $(docker ps -a -q) |
Delete all docker images
$ docker rmi $(docker images -q) |
cloud engineer
by Ulysses
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)
by Ulysses
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
by Ulysses
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 &
by Ulysses
Tomcat requires JRE.
wget jre-8uversion-linux-x64.tar.gz # or apt-get install default-jdk |
wget jre-8uversion-linux-x64.tar.gz # or apt-get install default-jdk
Install Tomcat 8 on Linux.
wget https://mirrors.gigenet.com/apache/tomcat/tomcat-8/v8.5.66/bin/apache-tomcat-8.5.66.tar.gz tar zxpvf apache-tomcat-8.5.66.tar.gz cd /opt/tomcat/apache-tomcat-8.5.66/bin/ ./startup.sh |
wget https://mirrors.gigenet.com/apache/tomcat/tomcat-8/v8.5.66/bin/apache-tomcat-8.5.66.tar.gz tar zxpvf apache-tomcat-8.5.66.tar.gz cd /opt/tomcat/apache-tomcat-8.5.66/bin/ ./startup.sh
Status|Start|Stop|Restart Tomcat.
systemctl status tomcat8 systemctl start tomcat8 systemctl stop tomcat8 systemctl restart tomcat8 |
systemctl status tomcat8 systemctl start tomcat8 systemctl stop tomcat8 systemctl restart tomcat8
by Ulysses
Here are the commands to start, stop, enable and get the status of Apache on RHEL and CentOS.
systemctl enable httpd # enable on bootup systemctl status httpd # get status systemctl start httpd # start systemctl stop httpd # stop systemctl restart httpd # restart |
systemctl enable httpd # enable on bootup systemctl status httpd # get status systemctl start httpd # start systemctl stop httpd # stop systemctl restart httpd # restart
by Ulysses
Here’s how to run docker-compose. I have an Icecast docker-compose.yml file. Icecast is an audio streaming server.
version: "2" services: icecast: image: moul/icecast environment: - ICECAST_SOURCE_PASSWORD=secret - ICECAST_ADMIN_PASSWORD=secret - ICECAST_PASSWORD=secret - ICECAST_RELAY_PASSWORD=secret ports: - "8000:8000" restart: always |
version: "2" services: icecast: image: moul/icecast environment: - ICECAST_SOURCE_PASSWORD=secret - ICECAST_ADMIN_PASSWORD=secret - ICECAST_PASSWORD=secret - ICECAST_RELAY_PASSWORD=secret ports: - "8000:8000" restart: always
To run Icecast in a container , I run docker-compose in the background.
docker-compose up -d |
docker-compose up -d
Check to see if Icecast is running on your browser.
http://localhost:8000 |
http://localhost:8000
To stop the Icecast container, I simply stop the docker-compose.
docker-compose stop |
docker-compose stop
Here are the other docker commands you can run.
docker images docker ps docker-compose ps |
docker images docker ps docker-compose ps
by Ulysses
Here are the start and stop scripts for the lastest Wowza version 4.8.0.
Start scripts
sudo service WowzaStreamingEngine start # or /etc/init.d/WowzaStreamingEngine start |
sudo service WowzaStreamingEngine start # or /etc/init.d/WowzaStreamingEngine start
Stop scripts
sudo service WowzaStreamingEngine stop # or /etc/init.d/WowzaStreamingEngine stop |
sudo service WowzaStreamingEngine stop # or /etc/init.d/WowzaStreamingEngine stop
by Ulysses
Here’s how to start multiple instances using Bash and Google SDK.
#!/bin/bash while IFS=', ' read -r a b c; do instance="${a//[[:blank:]]/}" project="${b//[[:blank:]]/}" zone="${c//[[:blank:]]/}" echo "Starting $instance ...." gcloud compute instances start $instance \ --zone $zone --project $project --async done < instance-list.txt |
#!/bin/bash while IFS=', ' read -r a b c; do instance="${a//[[:blank:]]/}" project="${b//[[:blank:]]/}" zone="${c//[[:blank:]]/}" echo "Starting $instance ...." gcloud compute instances start $instance \ --zone $zone --project $project --async done < instance-list.txt
Instances are read from an external file. The file format is displayed below.
server1,project1,us-central1-a server2,project2,us-central1-b server3,project3,us-central1-c |
server1,project1,us-central1-a server2,project2,us-central1-b server3,project3,us-central1-c
To stop multiple instances, replace “start” with “stop.”