How to install Docker on Ubuntu using VMware Workstation running on Windows

This is a quick guide on how to install Docker (Engine 24.0.2) on Ubuntu version 22.04.2 LTS using VMware Workstation 16.2.4 (running on Windows)

First on your VMware Workstation Software Create a new Ubuntu VM.  You can download the .iso for this from here.

Then you will need to download Docker for Ubuntu from here.

If you have downloaded the Docker files onto your Windows desktop you will need to enable access from the Windows machine to the Ubuntu VM.  To do this first enable the VMware shared folder:

Select the virtual machine and select VM > Settings.

On the Options tab, select Shared Folders.

Select Always Enabled

Click Add to add a shared folder.

On Windows hosts, the Add Shared Folder wizard starts. On Linux hosts, the Shared Folder Properties dialog box opens.

Browse to, or type, the path on the host system to the directory to share.
If you specify a directory on a network share, such as D:\share, Workstation Pro always attempts to use that path. If the directory is later connected to the host on a different drive letter, Workstation Pro cannot locate the shared folder.

Specify the name of the shared folder as it should appear inside the virtual machine and click Next.

Select Enable this share

Click Finish to add the shared folder.
The shared folder appears in the Folders list. The check box next to folder name indicates that the folder is being shared. You can deselect this check box to turn off sharing for the folder.

Click OK to save your changes.

On your Ubuntu VM open the terminal and type:

vmware-hgfsclient

 

You should see the name of your shared folder. You should be able to browse in Ubuntu to Computer/mnt to see the files. There is some issue in Ubunto 22.04.2 LTS which meant this didn’t work. Run the below command to enable access to the hgfs folder:

sudo vmhgfs-fuse .host:/ /mnt/hgfs/ -o allow_other -o uid=1000

 

If this does not work just run the below to use the mnt folder:

sudo vmhgfs-fuse .host:/ /mnt/ -o allow_other -o uid=1000

 

You should now be ready to install Docker. We will start with the prerequisites and the Package Repository. Run the command:

 sudo apt-get update
 sudo apt-get install ca-certificates curl gnupg

 

Then run:

 sudo install -m 0755 -d /etc/apt/keyrings
 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
 sudo chmod a+r /etc/apt/keyrings/docker.gpg

 

Then run:

 echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

 

Now we can install the engine:

 sudo apt-get update

 

Install the latest version:

 sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

 

Confirm installation success

sudo docker run hello-world

 

Now we can install the .deb package. Earlier we used VMware Workstation to mount the file to the mount folder. Navigate to the mnt folder in Ubuntu desktop and copy the file to the downloads folder. Go back to the terminal and switch to the downloads folder:

cd ~/Downloads

 

Then start the installation:

sudo apt-get install ./docker-desktop-4.20.1-amd64.deb

 

You can now start Docker Desktop:

systemctl --user start docker-desktop

 

Check the versions:

docker compose version

docker --version

docker version

 

Run a test Docker to check its working!

sudo docker run docker/whalesay cowsay hello world

Leave a Reply

Your email address will not be published. Required fields are marked *