Tag Archives: shell

Simple Script to List and Remove All Stopped Docker Containers

While using Docker command lines, I found it’s sometime a bit confusing to deal with containers. For the underlying operating system, a container is like a process. That is why the docker command use “ps” as the command to list these commands.

However, the typical “ps” command lists all the running processes. When a process dies, it is gone and there is no need to list it at all. For the containers, the story is different. The container can also be stopped, paused, which is different from running state. But you can still bring them back to running state later.

Posted in Software Development | Also tagged , | 3 Responses

How to Create New User in ESXi With Shell Script

It’s pretty easy to create a new user using vSphere APIs in Java. If you want one or two lines of scripts, you can write a few line Python script using PyVimomi wrapped by a command line. Even easier is a solution discussed at PureVirtual.

The trick is really about how to access the adduser command, which is available but not accessible from console as it is. To use the command, you have to type the following command from ESXi console: (I assume there are a few more commands that can be used in the same way)

Posted in Virtualization | Also tagged , | 2 Responses

Powerful Hacks With ESXi vim-cmd Command, Together With Shell Commands

If you have read my previous article on the vim-cmd, you may have realized how handy it is, especially when it comes to manage virtual machines. There is however a pretty challenging problem to use it – for most commands for a virtual machine, it requires vmid which is an integer that uniquely identifies the virtual machine in the context of an ESXi server. It’s like primary key in SQL database to locate a record (virtual machine instance) in a table (virtual machine type). For people who are familiar with vSphere APIs, the vmid is the same as the value of ManagedObjectReference value of a virtual machine in ESXi. Because most administrators who use commands are not necessarily familiar with vSphere API, it doesn’t help much.

Posted in Virtualization | Also tagged , , | 7 Responses
  • NEED HELP?


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__ doublecloud.org.

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.