Just Another IT Blog

It's time to share some of my experiences, crazy ideas, tips and tricks !!!

Post Page Advertisement [Top]



If you play long enough with vSphere Integrated Containers (VIC), sooner you will realize how long and tedious are the vic-machine commands.

Do you know you can make use of VIC variables to simplify those day to day activities?!?

Taking as an example the simple task of listing all your created VCHs, you would need a command like that:

vic-machine ls --target vcenter.vsphere.local --user administrator@vsphere.local --password Secure123 --thumbprint 2F:C3:3C:5D:99:B6:31:87:77:58:4D:8F:2F:75:D9:0C:01:F8:FE:6B

As I said….loooong !!!!
What if I tell you can just run: vic-machine ls instead
Much simpler, right ?!?!

Well, that’s all possible setting up the VIC variables, that will store your values and use them on future commands; these are the ones:

  • VIC_MACHINE_TARGET: that’s the variable that tells which is your target vCenter to use;  
  • VIC_MACHINE_USER: the username with privileges to run commands against your target vCenter;   
  • VIC_MACHINE_PASSWORD: the password for the username you just specified with VIC_MACHINE_USER;
  • THUMBPRINT: the variable that contains the thumbprint of your target vCenter;

You just need to set your environment variables to make it works.
Depending on your operations system the command to set environment variables are different;
For Linux:       export “variable”=”value”
For Windows: set “variable”=”value”

Now, let’s see how our example will looks like:

Run: export VIC_MACHINE_TARGET=vcenter.vsphere.local
Run: export VIC_MACHINE_PASSWORD=Secure123
Run: Export VIC_MACHINE_THUMBPRINT=2F:C3:3C:5D:99:B6:31:87:77:58:4D:8F:2F:75:D9:0C:01:F8:FE:6B
Run: vic-machine ls

Now you can just run vic-machine commands like ls, create, delete, configure and others without having to provide the same information over and over again.

Since we are talking about making your life easier, do you know Docker has it’s own variables too?

To check the information of your docker host you would run a command like that:
docker –H 192.168.10.10:2376 --tls --tlscacert /home/vch01/ca.pem --tlscert /home/vch01/cert.pem --tlskey /home/vch01/key.pem info

Would it not be better just run: docker info

Yes you can, it works the same way, setting up DOCKER variables, these are the most common ones;

  • DOCKER_HOST: set your target docker host or VCH in our case; 
  • DOCKER_TLS_VERIFY: set your docker client to check for TLS, set to 1 to enable verification; 
  • DOCKER_CERT_PATH: the path where docker host certificate and keys could be found, keep all certificates for the same docker host on the same folder, that makes things easier down the road;   
  • DOCKER_CONTENT_TRUST: when set to 1, it enables content trust;  
  • DOCKER_CONTENT_TRUST_SERVER: set your notary server for content trust verification and signature;
 Give it a shot, I bet you will feel more productive and less tedious.

See you next.
 

Bottom Ad [Post Page]