26 July 2022

Docker Commands Cheat Sheet

run container

docker run

run container and drop to shell

docker run -it 
docker run --interactive --tty 

run container in background

docker run -d

container restart setings

docker run --restart (always|no|on-failure[:maxretries]|unless-stopped) 

remove container when exited

docker run --rm 

view containers running

docker container ls
docker container ls -a

start container

docker start

stop container

docker stop

remove container

docker rm

remove all stopped

docker container prune

rename container

docker rename

view containers metrics

docker stats []

copy file into container

docker cp file.ext :/path/to/folder/

view container information

docker inspect

Find container’s IP

docker inspect | grep IPAddress

Make a container an image

docker commit

Map container port to host port

docker run -p :
30 December 2021

Open and Extract .tar files on Windows

What I’m about to say might be a surprise to you… But you don’t need to install any sort of 3rd party software (like 7zip or WinZip) to extract tarball files on WIndows. Windows 10 actually has the functionality built-in. I know, I was just as surprised to learn about it as you are. From the command line, you can use the “Tar” command to easily extract .tar, .gz, or tar.gz files.


For folks out there that don’t know;

  • A tarball file, ‘.tar’, is just a type of archived file. They are basically, a collection of files that have been merged into one single file.
  • Gzip files, ‘.gz’, are a type of compressed file and it is used to save on the amount of space that a file uses on the hard drive.
  • If you’re following along, then you’ll already have realized that a ‘.tar.gz’ file means that it is just a compressed archive file.

Here’s how to extract your tarball file in Windows 10.

Open the ‘Start Menu’ and search for “cmd”. Right-click on “Command Prompt” and select “Run as administrator“.

Enter the following command inside the window.

tar -xvzf "Path to file" -C "Path to destination"

Example:

tar -xvzf C:\Source\file.tar.gz -C C:\Destination\

This example will extract the contents of the ‘file.tar.gz’ file from the “C:\Source\” folder to the “C:\Destination\” folder. 
Note: Make sure the ‘-C’ parameter before the path to the destination is an uppercase.

The parameters explained:

  • x — instructs tar to extract the archived content.
  • v — verbose mode. This is optional to display the extraction process. Otherwise, you will only see a blinking cursor until the process is complete.
  • z — instructs tar to uncompress the content with gzip.
  • f — provides tar the name of the file you’re about to extract.
  • C — uppercase and with a hypen, this tells tar to change folders to the specified folder

1 November 2021

Nutanix Cheat Sheet

Hopefully, this helps you as much as it helps me. This is by no means a comprehensive list. It’s just a place for me to jot down the various commands I use as I get to know Nutanix more intimately.

Run all NCC Health Checks

ncc health_checks run_all

Shutdown CVM

cvm_shutdown -P now

Check status of CVM metadata ring, see if all CVMs are ‘UP’

nodetool -h 0 ring

Check Cluster Status on CVM

Cluster status

Check if CVM processes are in UP state

cluster status | grep -v UP

Check CVM Metadata store status

ncli host ls | egrep "Meta[Id]Name"

Verify data resiliency

ncli cluster get-domain-fault-tolerance-status type=node

Check which CVM is the Minerva Leader

afs info.get_leader

Check which CVM is the Prism Leader

afs info.prism_leader

Check which CVM is the LCM Leader

lcm_leader

Start cluster

Cluster start

Restart prism on CVM

genesis restart

Prism/CVM Status

genesis status

Check if CVM is in Maintenance Mode
Note: Only the Scavenger, Genesis, and Zeus processes must be running (process ID is displayed next to the process name).

genesis status | grep -v "\[\]"

Cluster/Host Hardware Info (RAM, DIMMs, CPUs, etc…) from CVM

ncc hardware_info show_hardware_info

Migrate VM to a different storage container (AOS >= 5.19)

acli vm.update_container vm-name container=target-container wait=false

Change AHV host name (AOS >= 5.20)

change_ahv_hostname --host_ip=HOST_IP --host_name=NEW-AHV-HOSTNAME

Get all CVM IPs within the cluster

svmips

Get all Host IPs within the cluster

hostips

Get all IPMI IPs within the cluster

ipmiips

Get Cluster Info

ncli cluster info

Get all Hosts Info

acli host.info
ncli host ls

Verify the state of Host
-Entered Maintenace: node_state equals to kEnteredMaintenanceMode and schedulable equals to False.
-Exited Maintenace: node_state equals to kAcropolisNormal and schedulable equals to True.

acli host.get host-ip

Put a CVM in maintenance mode

ncli host edit id=HOST_ID enable-maintenance-mode=true

Exit a CVM from maintenance mode

ncli host edit id=HOST_ID enable-maintenance-mode=false

Put an AHV host in maintenance mode
Note: “wait=true” allows the host to migrate VMs to other hosts before it enters maintenance mode.

acli host.enter_maintenance_mode HOST_IP wait=true

Exit an AHV host from maintenance mode

acli host.exit_maintenance_mode HOST_IP

Check if AHV host is Schedulable

acli host.list

Check AOS version on all CVMs

allssh 'cat /etc/nutanix/release_version'

Check AHV version on all nodes

hostssh 'cat /etc/nutanix-release'

List all VMs on a cluster

acli vm.list

List all VMs on a host

acli host.list_vms host

List VMs in a powered ON state

acli vm.list power_state=on

List VMs in a powered OFF state

acli vm.list power_state=off

Power off all VMs running on the cluster

for vm_name in `acli vm.list power_state=on | grep -v ^'VM
name' | awk '{print $1}'`; do acli vm.force_off $vm_name; done

Power on all VMs running on the cluster

for vm_name in `acli vm.list power_state=off | grep -v ^'VM
name' | awk '{print $1}'`; do acli vm.on $vm_name; done
Category: Nutanix | LEAVE A COMMENT