To enable copying and pasting to your VM running in your vsphere cloud the following steps need to be preformed in the vSphere Web Client (vCenter):
- Select the VM and to to the “Summary” page. Also make sure the VM is powered off.
- Open the “Edit Settings” popup
![2018-05-02 10_29_15-vSphere Web Client.png](file:////Users/joshc/Library/CloudStorage/ProtonDrive-josh@brucecloud.net-folder/Dropbox Backup/Personal Projects/BruceCloud/Publii/bruce-cloud/input/media/posts/19/2018-05-02-10_29_15-vsphere-web-client.png) - Now go to the “VM Options” tab
- Open the “Advanced” section and click “Edit Configuration”
![2018-05-02 10_30_31-vSphere Web Client.png](file:////Users/joshc/Library/CloudStorage/ProtonDrive-josh@brucecloud.net-folder/Dropbox Backup/Personal Projects/BruceCloud/Publii/bruce-cloud/input/media/posts/19/2018-05-02-10_30_31-vsphere-web-client.png) - Now add the following two rows:
| Name | Value | | isolation.tools.copy.disable | false | | isolation.tools.paste.disable | false |
This should look like the following:
![2018-05-02 10_35_20-vSphere Web Client.png](file:////Users/joshc/Library/CloudStorage/ProtonDrive-josh@brucecloud.net-folder/Dropbox Backup/Personal Projects/BruceCloud/Publii/bruce-cloud/input/media/posts/19/2018-05-02-10_35_20-vsphere-web-client.png)
Now you can power on your VM and enjoy!
Why is it not working?
For this to work you must also have VMWare Tools installed on the VM you are copying and pasting to.
References
https://pubs.vmware.com/vsphere-4-esxi-installable-vcenter/index.jsp?topic=/com.vmware.vsphere.esxi_server_config.doc_41/esx_server_config/security_deployments_and_recommendations/t_enable_copy_and_paste_operations_between_the_guest_operating_system_and_remote_console.htmlSo one thing that had me stumped for a while is why my python scripts would fail inside my docker container but not on my local machine. The python version was the same on my local and in the container.
The issue was that python was raising exceptions due to encoding errors in the container but not on my local.
How do I check what the encoding is in the container?
It turns out its really easy to check the encoding python will use:
$ python3
>>> import locale
>>> print(locale.getpreferredencoding(False))
ANSI_X3.4-1968
>>>
So instead of using UTF like I want python to use python is using ANSI…
Things that don’t work
The first thing I tried was setting the environment variable in the container:
$ printenv
HOSTNAME=0b3ceb252cac
TERM=xterm
LS_COLORS=...
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/home/working
SHLVL=1
HOME=/root
LESSOPEN=| /usr/bin/lesspipe %s
LESSCLOSE=/usr/bin/lesspipe %s %s
_=/usr/bin/printenv
$ export PYTHONIOENCODING=utf-8
$ python3
>>> import locale
>>> print(locale.getpreferredencoding(False))
ANSI_X3.4-1968
>>>
Which didn’t work…
Something that does work
In your DockerFile run:
# Set the locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
In the new container
$ python3
>>> import locale
>>> print(locale.getpreferredencoding(False))
UTF-8
>>>
Thanks to Jared Markell for the tutorial.