It's using docker to create a full encapsulated working environment.
The usage is really simple and fully transparent to the user. You will not
even notice that you are working in the environment. All programs can be started
from the _outsite_ as if they were usual programs. They are automatically
wrapped 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 also
bound the that specific operating system. In some cases you are not allowed to
install and run your own privileged services like a database or use another
version of a software.
Docker - although some people call it the virtualenv killer - lacks of
usability to be a virtualenv replacement. You will always need some handcrafted
scripts to make it handsome.
Cleanenv wraps programs running in docker containers as if they were part of your
host machine. Programs, users and pathes are mapped transparently. You can use
it as a drop-in-replacement to virtualenv.
And it's not strictly bound to python. Everything that you want to transparently
execute isolated can be used with cleanenv. Suppose you need to run a newer or
older version of ruby but cannot upgrade/downgrade your host system version.
Cleanenv creates a shortcut binary for you to let you run it isolated with
your 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/activate
To deactivate, but not destroy, the environment type:
$ deactivate
On deactivation, all running processes are stopped. If you want to keep them
running, use the --persistent directive on creation.
To start a program, e.g. a mysql server, whenever the environment is activated
use the --on-activate directive. The <program> argument will be executed inside
the 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, you
should use the --persistent directive. This keeps your container running even
when your programs exits.
Because docker containers are completely isolated to the host system, all
existing users of your host system does not exist in the container. Cleanenv
automatically creates a user inside the docker container that matches the user
who 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 achieved
with 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 into
the container under the path `/r`. To override these settings you can provide
a mapping like:
$ cleanenv create --directory <host-path>:<container-path>[:rw]
If `:rw` is not present, the host-path is mounted read-only. Be careful when
using :rw (full access read and write) mounts. You may alter/delete files in
your host system, because of missing security features in docker.
Configuration file
==================
If you have a complex configuration or you need a reproducable configuration
you can put all above mentioned settings into a .cleanenv.conf file.
When executing `cleanenv create <path>` it searches this file in the current
working 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 environment
you 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 removed
when you don't need the environment anymore. To remove them just type:
$ cleanenv destroy
inside the activated environment or directly:
$ <path>/bin/destroy
Using snapshots (not implemented yet, sorry)
===============
Snapshots are used to store the current state of the docker container for
rollback 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 list
Create a snapshot:
$ cleanenv snapshot create [<name>]
Restore a snapshot:
$ cleanenv snapshot <id|name>
To restore the initial start - after creating the cleanenv - use:
$ cleanenv reset
Be careful when doing this, because all snapshots may get lost on the next
snapshot creation.
To freeze the state of your cleanenv, type:
$ cleanenv freeze
It creates a docker image with a snapshot history and prevents all upcoming
changes.
$ cleanenv unfreeze
reverts the freeze state, which means you are free to do any changes.
Metadata
Release files for cleanenv 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cleanenv-0.1.3.tar.gz | 908.9 kB | Without provenance | Details for cleanenv-0.1.3.tar.gz |
Release files / cleanenv-0.1.3.tar.gz
| Download URL | cleanenv-0.1.3.tar.gz |
|---|---|
| Size | 908.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e9cb2433c59ba78f88a92d353c66166b2def174d3619c0e5fb7eb4d2c87e114b
|
|
BLAKE2b-256 checksum How to use checksums |
ce5ef75d43558b25fe99b7ff8c4fc5c8681b4229609e8c00446d0dd4cf8e7e2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for cleanenv 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.