Jume - My Virtualization Blog

My personal and professional virtualization blog. Everything about VMware, PowerCLI, Powershell, Agile, Scrum, VSAN and Cloud related.

Duplicate your prod environment to a container based dev environment

In my previous post I explained how you can run VCSIM in a native M1 container. If you don't use a Mac with that CPU you can just download the official container and run it local in Docker.

Now, VCSIM contains a cool feature to load in an environment. William Lam did a great article about that. You first need to export it first using GOVC:

$ export GOVC_URL=user:pass@host
$ export GOVC_INSECURE=true     # if needed
$ govc object.save 
> set GOVC_URL=user:pass@host
> set GOVC_INSECURE=true     # if needed
> govc object.save 

This will connect to your vCenter or ESXi host and exports all the configuration items. Each and every object will get it's own XML file, which looks like this:

Results of govc object.save

To use this export in VCSIM from a container, you can bind a local volume to it, and start that container:

$ docker run -d -p 8989:8989 \
--name vc-wd1 \
--mount type=bind,source="$(pwd)"/vcsim-vc-wd1.fritz.box,target=/data,readonly \
bouke/vcsim:latest \
/vcsim -load data/ 

However, when trying to read the emulated vCenter environment, you'll get an error:

govc: Post "https://127.0.0.1:8989/sdk": EOF

 The solution

I've been trying to find a solution on the internet, but couldn't find any. But I've found one myself. It appears you can add the -l (listen address switch) with 0.0.0.0:port as address. This should fix it:

$ docker run -d -p 8989:8989 \
--name vc-wd1 \
--mount type=bind,source="$(pwd)"/vcsim-vc-wd1.fritz.box,target=/data,readonly \
bouke/vcsim:latest \
/vcsim -load data/ \
-l 0.0.0.0:8989 

Which looks like this:

Correct output

The cool thing now is you can fiddle with this emulator and play around with it. Next time you restart it, it will be in the original situation. If you want to save the new state with all the changes, you can always use GOVC to save the situation and link that to a new container - it's all up to you. Enjoy.

×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

.InstanceUuid≠ .ExtensionData.Client.ServiceConten...
Running vcsim native on Mac Silicon with M1 chip i...
 

Comments

No comments made yet. Be the first to submit a comment
Guest
Tuesday, 29 November 2022