~charles/bem

e2abb943cf7a2dd4a93aa328d2a3b070f12c8636 — Charles Daniels 4 years ago 8fbd361
use host natwork_mode by default
3 files changed, 7 insertions(+), 1 deletions(-)

M README.md
M bem/bem_constants.py
M bem/bem_engine.py
M README.md => README.md +1 -0
@@ 150,6 150,7 @@ easy to, for example, specify a file relative to the project root.
	* `none` -- do nothing and set the UID within the container to 0 (root).
* `enable_ptrace` -- set to `True` to add the `SYS_PTRACE` capability to the
  container. (default: `True`)
* `network_mode` -- the desired Docker network mode (default: `host`)

The following config keys should not be changed, but may be used via for
substitution/indirection.

M bem/bem_constants.py => bem/bem_constants.py +1 -0
@@ 16,6 16,7 @@ config_defaults = {
    "squashmethod": "bind",
    "noenvpassthrough": False,
    "enable_ptrace": True,
    "network_mode": "host",
}

default_ps1 = "[BEM:$BEM_PROJECT] $(whoami)@$(hostname) $(pwd) $ "

M bem/bem_engine.py => bem/bem_engine.py +5 -1
@@ 73,7 73,10 @@ def ensure_image_built(config):
    projectdir = pathlib.Path(config["projectdir"])

    client = docker.from_env()
    image = client.images.build(path=str(projectdir), dockerfile=str(dockerfile))
    image = client.images.build(path=str(projectdir),
            dockerfile=str(dockerfile),
            network_mode=config["network_mode"],
        )

    logging.info("image build completed.")
    logging.debug("\t{}".format(image))


@@ 178,6 181,7 @@ def execute_command(config, command):
            host_config=client.api.create_host_config(
                binds=volumes,
                cap_add=caps,
                network_mode=config["network_mode"],
            ),
            user=user,
            environment=config["#environment"],