For those of you using VMware's free AppCatalyst Hypervisor, you may have noticed that there is currently not a way to update to the latest Docker 1.9 Engine/Client using Photon's package manager, Tiny Dandified YUM (tndf). Although you can manually install Docker 1.9 on any deployed PhotonOS VMs from AppCatalyst, the only issue with that is that all VMs based off of the default PhotonOS template will still be running version 1.8, which means you would need to apply to do this on ever new VM creation.
Not ideal at the moment, but there is a simple fix which is to update the default PhotonOS template with Docker 1.9. We can easily this simply by leveraging AppCatalyst itself to update itself 😉 or rather its default PhotonOS VMDK. Below are the manual steps if you wish to walk through this yourself, but if you rather just run a simple script that will compeltely automate the entire process, just jump straight to the bottom of this article 🙂
Step 1 - Create a new temp PhotonOS VM (in my example, I'm calling it PHOTON-DOCKER-1.9) which we will use to install Docker 1.9. You can do so by running the following command:
/opt/vmware/appcatalyst/bin/appcatalyst vm create PHOTON-DOCKER-1.9
Step 2 - Power on the temp PhotonOS VM that you just created by running the following command:
/opt/vmware/appcatalyst/bin/appcatalyst vmpower on PHOTON-DOCKER-1.9
Step 3 - Retrieve the IP Address of the temp PhotonOS by running the following command (this could take up to a minute or so to display):
/opt/vmware/appcatalyst/bin/appcatalyst guest getip PHOTON-DOCKER-1.9
Step 4 - We can now SSH to the temp PhotonOS by using the IP Address from the previous step. You will need to specify the private key to login to the PhotonOS by running the following command:
ssh -i /opt/vmware/appcatalyst/etc/appcatalyst_insecure_key photon@[IP-ADDRESS]
Step 5 - Now we will download and install Docker 1.9 but before doing so we also need to grab the "tar" utility as it does not seem to be part of the default PhotonOS. Here is a one-liner that will automatically install the tar utility and then perform the download and install of Docker (Thanks to Massimo Re'Ferre for his original install steps, just polishing up his awesomeness). Copy and paste the snippet below which you will run that inside of the PhotonOS:
sudo tdnf -y install tar;curl -O https://get.docker.com/builds/Linux/x86_64/docker-1.9.1.tgz;tar -zxvf docker-1.9.1.tgz;sudo systemctl stop docker;sudo cp usr/local/bin/docker /usr/bin/docker;sudo systemctl start docker;rm -rf usr/;rm -f docker-1.9.1.tgz;exit
Step 6 - Now that we have our PhotonOS updated with Docker 1.9, we just need to shut it down and replace the VMDK with AppCatalyst's default PhotonOS VMDK. Run the following command to find the name of your temp PhotonOS VMDK.
find "${HOME}/Documents/AppCatalyst/PHOTON-DOCKER-1.9" -name '*.vmdk'
Once you have the VMDK name, you should backup the original AppCatalyst's PhotonOS VMDK by running the following command:
sudo mv /opt/vmware/appcatalyst/photonvm/photon-disk1-cl1.vmdk /opt/vmware/appcatalyst/photonvm/photon-disk1-cl1.vmdk.bak
Next, we will copy our temp PhotonOS VMDK to AppCatalyst's default PhotonOS directory and replace its original VMDK by running the following command:
sudo cp ${HOME}/Documents/AppCatalyst/PHOTON-DOCKER-1.9/photon-disk1-cl2.vmdk /opt/vmware/appcatalyst/photonvm/photon-disk1-cl1.vmdk
Finally, we need to make sure the new VMDK has the correct permissions by running the following command:
sudo chmod 644 /opt/vmware/appcatalyst/photonvm/photon-disk1-cl1.vmdk
Step 7 - At this point, you can verify that your changes were successful by creating a new PhotonOS VM and once logged into the VM, you can run "docker version" to verify that you are now running Docker 1.9 as shown in the screenshot below.
For those those of you who do not wish to go through the manual steps, here is a quick script called update_docker_client_in_appcatalyst.sh which automates this entire process describe in the instructions above. Here is a quick screenshot of a sample execution of the script. I am hoping the Photon team will be updating the tdnf online repo so that you can simple run yum -y update docker in the future.
On appcatalyst vmpower on PHOTON-DOCKER-1.9 I got the following errors:
2015-12-29T22:26:05.705+02:00| vmx| W115: Cannot determine message file path for locale "en".
2015-12-29T22:26:05.707+02:00| vmx| I125: DictionaryLoad: Cannot open file "/Library/Preferences/VMware AppCatalyst/config": No such file or directory.
2015-12-29T22:26:05.708+02:00| vmx| I125: Msg_Reset:
2015-12-29T22:26:05.708+02:00| vmx| I125: [msg.dictionary.load.openFailed] Cannot open file "/Library/Preferences/VMware AppCatalyst/config": No such file or directory.
2015-12-29T22:26:05.708+02:00| vmx| I125: ----------------------------------------
2015-12-29T22:26:05.708+02:00| vmx| I125: ConfigDB: Failed to load /Library/Preferences/VMware AppCatalyst/config
2015-12-29T22:26:05.708+02:00| vmx| I125: DictionaryLoad: Cannot open file "/dev/null/Non-existing DEFAULT_LIBDIRECTORY/config": Not a directory.
2015-12-29T22:26:05.708+02:00| vmx| I125: Msg_Reset:
2015-12-29T22:26:05.708+02:00| vmx| I125: [msg.dictionary.load.openFailed] Cannot open file "/dev/null/Non-existing DEFAULT_LIBDIRECTORY/config": Not a directory.
2015-12-29T22:26:05.708+02:00| vmx| I125: ----------------------------------------
2015-12-29T22:26:05.708+02:00| vmx| I125: ConfigDB: Failed to load /dev/null/Non-existing DEFAULT_LIBDIRECTORY/config
Can you send me a sample configuration file?
These aren't actual errors, but rather warnings. I get the same as well and are related to the AppCatalyst config files which would override any existing defaults. This file does not exist by default. If you can successfully power on the VM, which in this case is nothing more than creating a cloned VM from the default template, you'll be good.
Thanks for your answer! Yes I can clone the Photon VM, but I can't SSH to it with this command, ssh -i /opt/vmware/appcatalyst/etc/appcatalyst_insecure_key photon@[IP-ADDRESS]. It is asking for password, the appcatalyst_insecure_key photon is in the right path. Do you know, where can I find an AppCatalyst sample configuration file?
Not being able to login has nothing to do with AppCatalyst configuration file. The default installation should allow you to clone from the default Photon VM and login using the SSH key that's included. If you're not able to do this, then I would double check your install and perhaps permissions on the SSH keys themselves. This should just work before even moving forward with any of the instructions outlined.
Yes, you are right, it was permission problem, now is working.
Thanks for your support!
hi Peter, how did you fix it? i am facing the same password issue:(
It was problem with permissions on the SSH keys.
/opt/vmware/appcatalyst/etc/appcatalyst_insecure_key
What a great and informative post. Thanks for posting
Just a few notes from TP2 and using Docker 1.10.x and 1.11.x
- Docker 1.11.x has 4 binaries now instead of 1, I haven't tried this yet, but be aware you need to consider the additional binaries
- With Docker 1.10.0 and newer releases requires that you change the "docker.service"
Change "ExecStart=/bin/docker -d -s overlay"
To "ExecStart=/bin/docker daemon -s overlay"
Reload systemctl-daemon with "systemctl daemon-reload"
Then you can start your docker daemon without errors.
Also with TP2, the sudo command is not available, at least not in the minimal install, I logged in as root to complete the tasks.