• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

stop

Stop and remove all Docker containers

December 11, 2021 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)

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

Migrate VM to Other Network

July 20, 2021 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

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

GCP Rename VM

July 16, 2021 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 &

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

Tomcat Install

June 4, 2021 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

Filed Under: Misc Tagged With: apache, install, restart, server, start, status, stop, tomcat, web

HTTPD on Redhat & Centos

December 4, 2020 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

Filed Under: Linux Tagged With: centos, enable, redhat, start, status, stop

Run Docker Compose

February 27, 2020 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

Filed Under: Cloud Tagged With: docker, docker-compose, icecast, start, stop

Wowza 4.8.0 Scripts

February 22, 2020 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

Filed Under: Cloud Tagged With: 4.8.0, script, start, stop, wowza

GCP Start Multiple Instances

January 19, 2020 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.”

Filed Under: Cloud Tagged With: compute, gcloud, instances, multiple, sdk, start, stop

  • Go to page 1
  • Go to page 2
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2012–2022