Basic Commands for VMware Photon and Docker

photon-logoThis post is a quick collection of commands used to configure VMwares recently released Photon OS, and to get started with Docker.

Photon is a technology preview of a minimal Linux container host. It is designed to have a small footprint and boot extremely quickly on VMware platforms. Photon is intended to invite collaboration around running containerized applications in a virtualized environment.

To get started with Photon, check this post.

Enable SSH access for root

#Change "PermitRootLogin no" to "PermitRootLogin yes"
nano /etc/ssh/sshd_config
systemctl restart sshd
sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
systemctl restart sshd

Configure Network
The network configuration is stored in /etc/systemd/network/ To configure a static IP address, disable DHCP configure static addresses:

root [ ~ ]# mv /etc/systemd/network/  /etc/systemd/network/
root [ ~ ]# nano /etc/systemd/network/
root [ ~ ]# cat /etc/systemd/network/


#Restart network
root [ ~ ]# systemctl restart systemd-networkd.service

#Display IP address information
root [ ~ ]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:BA:E5:39
          inet addr:  Bcast:  Mask:
          RX packets:114 errors:0 dropped:0 overruns:0 frame:0
          TX packets:98 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12757  TX bytes:16234

#Display routing table
root [ ~ ]# ip route
default via dev eth0  proto static dev eth0  proto kernel  scope link  src

Manage Services

#Start service 
systemctl start sshd

#Stop service
systemctl stop sshd

#Restart service
systemctl restart sshd

#Configure a service to be automatically started at boot time
systemctl enable sshd

Logfiles in Photon are managed by the journald daemon. To see the logs that the journald daemon has collected, use the journalctl command.

#Display all Logs

#Display Logs from a specific Unit
journalctl -u sshd

#Display Kernel messages (Similar to dmesg)
journalctl -k

#Display only error messages (and higher)
journalctl -p err

# Active Monitoring (Follow Logs, similar to tail -f)
journalctl -f

# Display only last 20 lines (Similar to tail -20)
journalctl -n 20

Docker Basics

#Start docker and enable it to be started at boot time
systemctl start docker
systemctl enable docker

#Download a Docker container (
docker pull vmwarecna/nginx

#Display local stored Docker images
docker images

#Start Docker Container
# -d       - Run the container in the background
# -p 80:80 - Publish the container's port to the host
docker run -d -p 80:80 vmwarecna/nginx

#List running Docker Containers
docker ps

#Display the public-facing port that is NAT-ed to the container 
#(Container ID from docker ps command)
docker port 5f6b0e03c6de

#Stop Docker Container
docker stop 5f6b0e03c6de

#Automatically start Docker containers at boot time
#To start a container at boot time the restart policy parameter is used.  
docker run --restart=always -d -p 80:80 vmwarecna/nginx
  1. Photon: linux by VMWARE | Ivan Zini - pingback on April 28, 2015 at 9:18 am
  2. Thanks, and for to change keyboard layout map from qwerty to azerty ?

    • It is just terrible!!!! I live in Belgium and you need to install the full installation to change the keyboard because you need the localectl command.

      Look at:

      But still then I did often the following commands to change the keyboard to get the right keys (figures,=_) But the key for : I did not find. To quit the vi editor, I use ZZ.

      For changing the network, I use "ip a" >> /etc/systemd/network/10.... and then change that file

      localectl set-keymap=be-latin1
      localectl set-keymap=uk

      So, buy a querty keyoard for working on consoles. It is everywhere the same ....

  3. It looks like there's no "nano" in Photon. Just use "vi" instead.

  4. This did not work on my installation. My network device is called "ens3", not "eth0". Even if I set Name=* it still does not take the static IP configuration.

  5. Since systemd there are a lot of network interface name prefixes possible, e.g. enoX, ensX, enpXsY, enxX,...
    To fetch the right one just perform an "ifconfig" command. To understand this behavior I strictly recommend the follwoing article:

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trackbacks and Pingbacks: