Skip to content

pmmaga/phocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phocker

An exercise in self-isolation using PHP

Requirements

  • linux 3.8+
  • util-linux package
  • PHP 7.0+
  • ext-posix

Installation

  • Clone this repository
  • Pick a minimal rootfs of your choice and copy its contents to the images/[name of the image] folder. Some root filesystems you may try:

Usage

  • ./phocker run [image] [command] to launch a container and execute the command in it.
  • ./phocker exec [container] [command] to execute a command on a running container.

Examples

pedro@host ~/dev/pmmaga/phocker $ ./phocker run alpine ls
bin  boot  dev	etc  home  lib	lib64  media  mnt  opt	proc  root  run  sbin  srv  sys  tmp  usr  var

pedro@host ~/dev/pmmaga/phocker $ ./phocker run alpine ps
  PID TTY          TIME CMD
    1 ?        00:00:00 php
    6 ?        00:00:00 sh
    7 ?        00:00:00 ps

pedro@host ~/dev/pmmaga/phocker $ echo "Hello phocker!" | ./phocker run alpine cat --
Hello phocker!

pedro@host ~/dev/pmmaga/phocker $ ./phocker run ubuntu /bin/bash
root@phocker:/# whoami
root
root@phocker:/# hostname
phocker
root@phocker:/# exit
exit

Tips

The containers are not removed after exiting. Periodical cleanup of the containers/ folder may be advisable.

Motivation

Heavily inspired by Liz Rice's talk Containers from scratch and the corresponding repository I set out to try to accomplish the same using PHP.

It also helped me better understand the process behind the isolation achieved by container runtime engines.

About

An exercise in self-isolation using PHP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages