Hello Everyone,
Please find below commands to create VM using azure cli `az`
Hello Everyone,
Please find below commands to create VM using azure cli `az`
Hello Team,
Today Morning suddenly my Mac started giving trouble with RSA Secure ID software which we use to generate random OTP to connect with our secure VPNs.
I am getting an error as below while launching RSA Secure ID
λ ~ ➤ stoken import -- file="/Users/xxxxx.xxxxxx/Desktop/xxxxx.xxxxxx_xxxxxxxx.sdtid"
Enter new password:
Confirm new password:
λ ~ ➤ stoken
Enter password to decrypt token:
xxxxxx
Hello Everyone,
In this post, I will show you how to create a network in the docker and how to spin containers with static IP and Dynamic IP Address.
You can create a new network in the docker using below command
docker network create --subnet=172.18.0.0/16 mydockernetwork
As network created just do docker inspect to make sure all good with it
➜ ~ docker network create --subnet=172.18.0.0/16 mydockernetwork
a4d11712754b7d5bf3ba25e3c831c8512065ce77a66099948effc59d5bae968f
➜ ~ docker inspect mydockernetwork
[
{
"Name": "mydockernetwork",
"Id": "a4d11712754b7d5bf3ba25e3c831c8512065ce77a66099948effc59d5bae968f",
"Created": "2021-08-07T11:27:38.515202386+05:30",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.18.0.0/16"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {},
"Labels": {}
}
] ➜ ~ docker run --net mydockernetwork -it --name ubuntu_dynamic_ip3 ubuntuBy using docker inspect command lets extract IP Address of the above container.
➜ ~ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ubuntu_dynamic_ip3
172.18.0.2
➜ ~ docker run --net mydockernetwork --ip 172.18.0.4 -it --name ubuntu_static_ip ubuntu
root@71f58fb557c1:/# % ➜ ~ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
71f58fb557c1 ubuntu "bash" 6 seconds ago Up 5 seconds ubuntu_static_ip
ab563564d964 ubuntu "bash" 3 minutes ago Up 3 minutes ubuntu_dynamic_ip3
f4bc181d89af ubuntu "bash" 2 hours ago Up 2 hours ubuntu_container
➜ ~ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ubuntu_static_ip
172.18.0.4
Update #1: A Shell Function To Return Container IP Address.
As I have to get IP Address very often for different containers, I wrote a small function in bash which return IP Address of given container.
➜ test_playbook git:(master) ✗ function docker_ip function> docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" $1 ➜ test_playbook git:(master) ✗ docker_ip webserver 172.18.0.5 ➜ test_playbook git:(master) ✗ docker_ip mysql_db_ubuntu 172.18.0.4 ➜ test_playbook git:(master) ✗
You can add the function to your bashrc file and call the function any time. I use ZSH as my default shell, so I did as below
➜ test_playbook git:(master) ✗ vim ~/.zshrc ➜ test_playbook git:(master) ✗ exec $SHELL ➜ test_playbook git:(master) ✗ docker_ip webserver 172.18.0.5 ➜ test_playbook git:(master) ✗ tail -n 3 ~/.zshrc function docker_ip docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" $1 ➜ test_playbook git:(master) ✗
Hope it helps.
Thank you.
mkdir ~/my_learning
rsync is a utility for efficiently transferring and synchronizing files between a computer and an external hard drive and across networked computers by comparing the modification times and sizes of files
sudo yum install rsync
sudo apt-get install rsync
sudo pacman -S rsync
-r, --recursive recurse into directories
-z, --compress compress file data during the transfer
-v, --verbose increase verbosity
-h, --human-readable output numbers in a human-readable format
mkdir /run/media/username/ContinousImprovement/my_learning.
my_learninglocation.
cp [OPTIONS] source destination
rsync -zrvh /home/username/my_learning /run/media/username/ContinousImprovement/my_learning
.zshrcfile. If you are using bash, you can use
.bashrcand I have added below function using shell scripting at very bottom
# backup home directory
function backup_home
rsync -zrvh /home/username/my_learning /run/media/username/ContinousImprovement/my_learning
exec $SHELLor
source ~/.zshrc.
backup_homefrom terminal, your source directory will be backup to remote directory. if you want to automate it using a scheduler job, you can achieve same using
cron, but make sure target is available during execution.
➜ my_learning backup_home
sending incremental file list
my_learning/ansible/ansible.cfg
my_learning/ansible/inventory
my_learning/ansible/test.yaml
...
...
...
sent 51.93M bytes received 141 bytes 103.86M bytes/sec
total size is 55.07M speedup is 1.06
➜ my_learning
config.ssh.insert_key = false
config.ssh.private_key_path = "~/.vagrant.d/insecure_private_key"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.ssh.insert_key = false
config.ssh.private_key_path = "~/.vagrant.d/insecure_private_key"
end