This a quick cheat sheet of the commands that can be used when using zones (containers), for a more complete guide see solaris zones.
Zone States
Configured | Configuration has been completed and storage has been committed. Additional configuration is still required. |
Incomplete | Zone is in this state when it is being installed or uninstalled. |
Installed | The zone has a confirmed configuration, zoneadm is used to verify the configuration, Solaris packages have been installed, even through it has been installed, it still has no virtual platform associated with it. |
Ready (active) | Zone’s virtual platform is established. The kernel creates the zsched process, the network interfaces are plumbed and filesystems mounted. The system also assigns a zone ID at this state, but no processes are associated with this zone. |
Running (active) | A zone enters this state when the first user process is created. This is the normal state for an operational zone. |
Shutting down + Down (active) | Normal state when a zone is being shutdown. |
Files and Directories
zone config file | /etc/zones |
zone index | /etc/zones/index
Note: used by /lib/svc/method/svc-zones to start and stop zones |
Cheat sheet
Creating a zone | zonecfg -z <zone>
see creating a zone for a more details |
deleting a zone from the global ssytem | ## halt the zone first, then uninstall it zoneadm -z <zone> halt zoneadm -z <zone> uninstall ## now you can delete it |
Display zones current configuration | zonecfg -z <zone> info |
Display zone name | zonename |
Create a zone creation file | zonecfg -z <zone> export |
Verify a zone | zoneadm -z <zone> verify |
Installing a zone | zoneadm -z <zone> install |
Ready a zone | zoneadm -z <zone> ready |
boot a zone | zoneadm -z <zone> boot |
reboot a zone | zoneadm -z <zone> reboot |
halt a zone | zoneadm -z <zone> halt |
uninstalling a zone | zoneadm -z <zone> uninstall -F |
Veiwing zones | zoneadm list -cv |
login into a zone | zlogin <zone> |
login to a zones console | zlogin -C <zone> (use ~. to exit) |
login into a zone in safe mode (recovery) | zlogin -S <zone> |
add/remove a package (global zone) | # pkgadd -G -d . <package>
If the -G option is missing the package will be added to all zones |
add/remove a package (non-global zone) | # pkgadd -Z -d . <package>
If the -Z option is missing the package will be added to all zones |
Query packages in all non-global zones | # pkginfo -Z |
query packages in a specified zone | # pkginfo -z <zone> |
lists processes in a zone | # ps -z <zone> |
list the ipcs in a zone | # ipcs -z <zone> |
process grep in a zone | # pgrep -z <zone> |
list the ptree in a zone | # ptree -z <zone> |
Display all filesystems | # df -Zk |
display the zones process information | # prstat -Z
# prstat -z <zone> Note: -Z reports information about processes and zones |