Package: cleanenv
Clean environment is the logical successor of python's virtualenv.It's using docker to create a full encapsulated working environment.The usage is really simple and fully transparent to the user. You will noteven notice that you are working in the environment. All programs can be startedfrom the _outsite_ as if they were usual programs. They are automaticallywrapped and started in a docker container.Why not using docker or virtualenv directly===========================================Virtualenv not only lacks of full isolation from the host system. You are alsobound the that specific operating system. In some cases you are not allowed toinstall and run your own privileged services like a database or use anotherversion of a software.Docker - although some people call it the virtualenv killer - lacks ofusability to be a virtualenv replacement. You will always need some handcraftedscripts to make it handsome.Cleanenv wraps programs running in docker containers as if they were part of yourhost machine. Programs, users and pathes are mapped transparently. You can useit as a drop-in-replacement to virtualenv.And it's not strictly bound to python. Everything that you want to transparentlyexecute isolated can be used with cleanenv. Suppose you need to run a newer orolder version of ruby but cannot upgrade/downgrade your host system version.Cleanenv creates a shortcut binary for you to let you run it isolated withyour user and pathes mapped.Create an environment=====================$ cleanenv create <path>The simple `create` command creates an environment in the path specified.To enter the environment type:$ source <path>/bin/activateTo deactivate, but not destroy, the environment type:$ deactivateOn deactivation, all running processes are stopped. If you want to keep themrunning, use the --persistent directive on creation.To start a program, e.g. a mysql server, whenever the environment is activateduse the --on-activate directive. The <program> argument will be executed insidethe container after start up.$ cleanenv create --on-activate <program> --on-deactivate <program2> <path>(not implemented yet, sorry)If you plan to use programs inside the environment without entering it, youshould use the --persistent directive. This keeps your container running evenwhen your programs exits.Because docker containers are completely isolated to the host system, allexisting users of your host system does not exist in the container. Cleanenvautomatically creates a user inside the docker container that matches the userwho called cleanenv. You can override this settings with the --user directive:$ cleanenv create --user [<id>:]<name> <path>$ cleanenv create --user system:[<id>:]<name> <path>Mapping of programs to easily call them from your host machine can be achievedwith the --program directive:$ cleanenv create --link <full-path-in-container> <path>By default, only the root directory of you host system is mounted read-only intothe container under the path `/r`. To override these settings you can providea mapping like:$ cleanenv create --directory <host-path>:<container-path>[:rw]If `:rw` is not present, the host-path is mounted read-only. Be careful whenusing :rw (full access read and write) mounts. You may alter/delete files inyour host system, because of missing security features in docker.Configuration file==================If you have a complex configuration or you need a reproducable configurationyou can put all above mentioned settings into a .cleanenv.conf file.When executing `cleanenv create <path>` it searches this file in the currentworking directory. Alternatively you can provide a configuration file with`--config`Reset the state of an environment=================================To cleanup the environment and reuse it without fully destroying the environmentyou can use the `cleanenv reset` command.Internally it stops and removes the docker container.Proper destroying of an environment===================================Cleanenv manages a set of docker images (snapshots), which needs to be removedwhen you don't need the environment anymore. To remove them just type:$ cleanenv destroyinside the activated environment or directly:$ <path>/bin/destroyUsing snapshots (not implemented yet, sorry)===============Snapshots are used to store the current state of the docker container forrollback and roll-forward of changes.Set a program to automatically create a snapshot when executed.$ cleanenv snapshot configure pip --pattern 'install' --name 'pip-{id}'List available snapshots:$ cleanenv snapshot listCreate a snapshot:$ cleanenv snapshot create [<name>]Restore a snapshot:$ cleanenv snapshot <id|name>To restore the initial start - after creating the cleanenv - use:$ cleanenv resetBe careful when doing this, because all snapshots may get lost on the nextsnapshot creation.To freeze the state of your cleanenv, type:$ cleanenv freezeIt creates a docker image with a snapshot history and prevents all upcomingchanges.$ cleanenv unfreezereverts the freeze state, which means you are free to do any changes.