To run Docker on ESXi, deploy Photon OS on ESXi.
What is Photon OS? #
Photon OS is an open-source Linux container host optimized for VMware infrastructure. It features:
- Optimization for VMware hypervisor
- Container support
- Package management via
tdnf - Enhanced security
Since it is optimized for hypervisors, it is expected to have less overhead compared to installing Docker on other Linux distributions.
Downloading Photon OS #
For ESXi installations, Photon OS provides two options: OVA and ISO files.
- OVA Import: Pre-installed Photon OS, easily imported into ESXi with kernel tuning applied for ESXi environments. Missing packages can be installed using
tdnf. - ISO Installation: Traditional Linux installation method.
The OVA file, specifically OVA-hw13_uefi, is chosen for this setup. Downloading Photon OS
Installing Photon OS #
From the ESXi Web UI, select “Deploy a virtual machine from an OVF or OVA file” and proceed with the installation. The steps primarily involve clicking “Next” until completion.
Initial Login to Photon OS #
The root password is predefined for OVA installations. On first login, password change is required.
| Setting | Value |
|---|---|
| Username | root |
| Password | changeme |
Initial Configuration #
Installing Required Packages #
Install less and sudo:
tdnf install less sudoSetting a Static IP Address #
Photon OS uses systemd-networkd for network configuration. First, check the network interface name:
networkctl listCreate and edit /etc/systemd/network/00-static.network:
[Match]
Name=eth0
[Address]
Address=192.168.10.11/24
[Network]
DNS=192.168.10.254
[Route]
Gateway=192.168.10.254Adjust values according to the network environment.
Apply changes:
chmod 644 /etc/systemd/network/00-static.network
sed -i -e "s/yes/no/g" /etc/systemd/network/99-dhcp-en.network
systemctl restart systemd-networkd.service
ip aSetting Timezone #
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtimeSetting Hostname #
echo hostname > /etc/hostnameCreating a General User #
useradd -m -G wheel username
passwd usernameThe user is added to the wheel group, enabling sudo usage.
Configuring Firewall #
Modify /etc/systemd/scripts/ip4save to allow required ports:
-A INPUT -p tcp -m tcp --dport <port> -j ACCEPTApply changes:
sudo systemctl restart iptablesConfiguring SSH #
Disable root SSH login by modifying /etc/ssh/sshd_config:
PermitRootLogin noChange the default SSH port:
Port 50134Restart SSH service:
sudo systemctl restart sshdFor secure access, enable SSH key authentication.
Expanding Disk Space #
By default, OVA installations allocate 16GB of storage. To expand, shut down the virtual machine, adjust storage in ESXi Web UI, and restart the VM.
Use parted to resize partitions:
sudo tdnf install parted
sudo parted
print free
resizepart 2
quit
sudo resize2fs /dev/sda2
df -hConfiguring Docker #
Enable and start Docker service:
sudo systemctl enable docker
sudo systemctl start dockerVerify Docker installation:
sudo docker run --rm hello-world
sudo docker rmi hello-worldInstalling Docker Compose #
Download and set up Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod 755 /usr/local/bin/docker-composeA Docker environment was successfully set up on ESXi using Photon OS.