docker-run-cli


Namedocker-run-cli JSON
Version 0.9.7 PyPI version JSON
download
home_pageNone
Summary'docker run' and 'docker exec' with useful defaults
upload_time2024-04-09 11:31:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT License Copyright (c) 2023 Institute for Automotive Engineering (ika), RWTH Aachen University Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords docker container
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <img src="https://github.com/ika-rwth-aachen/docker-run/raw/main/assets/logo.png" height=130 align="right">

# *docker-run* – ``docker run`` and ``docker exec`` with useful defaults

<p align="center">
  <img src="https://img.shields.io/github/license/ika-rwth-aachen/docker-run"/>
  <a href="https://pypi.org/project/docker-run-cli/"><img src="https://img.shields.io/pypi/v/docker-run-cli?label=PyPI"/></a>
  <a href="https://pypi.org/project/docker-run-cli/"><img src="https://img.shields.io/pypi/dm/docker-run-cli?color=blue&label=PyPI%20downloads"/></a>
</p>

*docker-run* is a CLI tool for simplified interaction with Docker images. Use it to easily start and attach to Docker containers with useful predefined arguments.

> [!IMPORTANT]  
> This repository is open-sourced and maintained by the [**Institute for Automotive Engineering (ika) at RWTH Aachen University**](https://www.ika.rwth-aachen.de/).  
> **DevOps, Containerization and Orchestration of Software-Defined Vehicles** are some of many research topics within our [*Vehicle Intelligence & Automated Driving*](https://www.ika.rwth-aachen.de/en/competences/fields-of-research/vehicle-intelligence-automated-driving.html) domain.  
> If you would like to learn more about how we can support your DevOps or automated driving efforts, feel free to reach out to us!  
> &nbsp;&nbsp;&nbsp;&nbsp; *Timo Woopen - Manager Research Area Vehicle Intelligence & Automated Driving*  
> &nbsp;&nbsp;&nbsp;&nbsp; *+49 241 80 23549*  
> &nbsp;&nbsp;&nbsp;&nbsp; *timo.woopen@ika.rwth-aachen.de*  

<p align="center">
  <img src="https://github.com/ika-rwth-aachen/docker-run/raw/main/assets/teaser.png" width=550>
</p>

While *docker-run* can be used with any Docker image, we recommend to also check out our other tools for Docker and ROS.
- [*docker-ros*](https://github.com/ika-rwth-aachen/docker-ros) automatically builds minimal container images of ROS applications <a href="https://github.com/ika-rwth-aachen/docker-ros"><img src="https://img.shields.io/github/stars/ika-rwth-aachen/docker-ros?style=social"/></a>
- [*docker-ros-ml-images*](https://github.com/ika-rwth-aachen/docker-ros-ml-images) provides machine learning-enabled ROS Docker images <a href="https://github.com/ika-rwth-aachen/docker-ros-ml-images"><img src="https://img.shields.io/github/stars/ika-rwth-aachen/docker-ros-ml-images?style=social"/></a>


## Quick Demo

The following quickly launches the GUI application `xeyes` to demonstrate how `docker-run` takes care of X11 forwarding from container to host. The `--verbose` flag prints the underlying `docker run` command that is run under the hood.

```bash
docker-run --verbose 607qwq/xeyes
```


## Functionality

`docker-run` is designed to be used the same way as the official [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) and [`docker exec`](https://docs.docker.com/engine/reference/commandline/exec/) commands.

In general, you can pass the same arguments to `docker-run` as you would pass to `docker run`, e.g.

```bash
docker-run --volume $(pwd):/volume ubuntu ls /volume
```

In addition to the arguments you are passing, `docker-run` however also enables the following features by default. Most of these default features can be disabled, see [Usage](#usage).
- container removal after exit (`--rm`)
- interactive tty (`--interactive --tty`)
- current directory name as container name (`--name`)
- relative bind mounts (`--volume [./RELATIVE_PATH>]:[TARGET_PATH]`)
- GPU support (`--gpus all` / `--runtime nvidia`)
- X11 GUI forwarding

If a container with matching name is already running, `docker-run` will execute a command in that container via `docker exec` instead. This lets you quickly attach to a running container without passing any command, e.g.

```bash
docker-run --name my-running-container
```

Unlike with `docker run`, you can also set the Docker image via the `--image` arguments, see [Usage](#usage). This may be required for more complex use cases.


## Installation

```bash
pip install docker-run-cli

# (optional) shell auto-completion
source $(activate-python-docker-run-shell-completion 2> /dev/null)
```

> **Warning**  
> Outside of a virtual environment, *pip* may default to a user-site installation of executables to `~/.local/bin`, which may not be present in your shell's `PATH`.  If running `docker-run` errors with `docker-run: command not found`, add the directory to your path. [*(More information)*](https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-to-the-user-site)  
> ```bash
> echo "export PATH=\$HOME/.local/bin:\$PATH" >> ~/.bashrc
> source ~/.bashrc
> ```


## Usage

```
usage: docker-run [--help] [--image IMAGE] [--mwd] [--name NAME] [--no-gpu]
                  [--no-it] [--no-loc] [--no-name] [--no-rm] [--no-tz]
                  [--no-x11] [--verbose] [--version]

Executes `docker run` with the following features enabled by default, each of
which can be disabled individually: container removal after exit, interactive
tty, current directory name as container name, GPU support, X11 GUI
forwarding. Passes any additional arguments to `docker run`. Executes `docker
exec` instead if a container with the specified name (`--name`) is already
running.

optional arguments:
  --help         show this help message and exit
  --image IMAGE  image name (may also be specified without --image as last
                 argument before command)
  --mwd          mount current directory at same path
  --name NAME    container name; generates `docker exec` command if already
                 running
  --no-gpu       disable automatic GPU support
  --no-it        disable automatic interactive tty
  --no-loc       disable automatic locale
  --no-name      disable automatic container name (current directory)
  --no-rm        disable automatic container removal
  --no-tz        disable automatic timezone
  --no-x11       disable automatic X11 GUI forwarding
  --verbose      print generated command
  --version      show program's version number and exit
```

## Plugins

`docker-run` can be extended through plugins. Plugins are installed as optional dependencies.

```bash
# install specific plugin <PLUGIN_NAME>
pip install docker-run-cli[<PLUGIN_NAME>]

# install all plugins
pip install docker-run-cli[plugins]
```

| Plugin | Description |
| --- | --- |
| [`docker-ros`](https://pypi.org/project/docker-run-docker-ros) | extra functionality for Docker images built by [*docker-ros*](https://github.com/ika-rwth-aachen/docker-ros) |

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "docker-run-cli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Lennart Reiher <lennart.reiher@rwth-aachen.de>, Jean-Pierre Busch <jean-pierre.busch@rwth-aachen.de>",
    "keywords": "docker, container",
    "author": null,
    "author_email": "Lennart Reiher <lennart.reiher@rwth-aachen.de>, Jean-Pierre Busch <jean-pierre.busch@rwth-aachen.de>",
    "download_url": "https://files.pythonhosted.org/packages/dc/5e/8cc6c1cc7c4c5f07c0d35229394e0ad6e7835e45ea9e6240ae0353078262/docker-run-cli-0.9.7.tar.gz",
    "platform": null,
    "description": "<img src=\"https://github.com/ika-rwth-aachen/docker-run/raw/main/assets/logo.png\" height=130 align=\"right\">\n\n# *docker-run* \u2013 ``docker run`` and ``docker exec`` with useful defaults\n\n<p align=\"center\">\n  <img src=\"https://img.shields.io/github/license/ika-rwth-aachen/docker-run\"/>\n  <a href=\"https://pypi.org/project/docker-run-cli/\"><img src=\"https://img.shields.io/pypi/v/docker-run-cli?label=PyPI\"/></a>\n  <a href=\"https://pypi.org/project/docker-run-cli/\"><img src=\"https://img.shields.io/pypi/dm/docker-run-cli?color=blue&label=PyPI%20downloads\"/></a>\n</p>\n\n*docker-run* is a CLI tool for simplified interaction with Docker images. Use it to easily start and attach to Docker containers with useful predefined arguments.\n\n> [!IMPORTANT]  \n> This repository is open-sourced and maintained by the [**Institute for Automotive Engineering (ika) at RWTH Aachen University**](https://www.ika.rwth-aachen.de/).  \n> **DevOps, Containerization and Orchestration of Software-Defined Vehicles** are some of many research topics within our [*Vehicle Intelligence & Automated Driving*](https://www.ika.rwth-aachen.de/en/competences/fields-of-research/vehicle-intelligence-automated-driving.html) domain.  \n> If you would like to learn more about how we can support your DevOps or automated driving efforts, feel free to reach out to us!  \n> &nbsp;&nbsp;&nbsp;&nbsp; *Timo Woopen - Manager Research Area Vehicle Intelligence & Automated Driving*  \n> &nbsp;&nbsp;&nbsp;&nbsp; *+49\u202f241\u202f80 23549*  \n> &nbsp;&nbsp;&nbsp;&nbsp; *timo.woopen@ika.rwth-aachen.de*  \n\n<p align=\"center\">\n  <img src=\"https://github.com/ika-rwth-aachen/docker-run/raw/main/assets/teaser.png\" width=550>\n</p>\n\nWhile *docker-run* can be used with any Docker image, we recommend to also check out our other tools for Docker and ROS.\n- [*docker-ros*](https://github.com/ika-rwth-aachen/docker-ros) automatically builds minimal container images of ROS applications <a href=\"https://github.com/ika-rwth-aachen/docker-ros\"><img src=\"https://img.shields.io/github/stars/ika-rwth-aachen/docker-ros?style=social\"/></a>\n- [*docker-ros-ml-images*](https://github.com/ika-rwth-aachen/docker-ros-ml-images) provides machine learning-enabled ROS Docker images <a href=\"https://github.com/ika-rwth-aachen/docker-ros-ml-images\"><img src=\"https://img.shields.io/github/stars/ika-rwth-aachen/docker-ros-ml-images?style=social\"/></a>\n\n\n## Quick Demo\n\nThe following quickly launches the GUI application `xeyes` to demonstrate how `docker-run` takes care of X11 forwarding from container to host. The `--verbose` flag prints the underlying `docker run` command that is run under the hood.\n\n```bash\ndocker-run --verbose 607qwq/xeyes\n```\n\n\n## Functionality\n\n`docker-run` is designed to be used the same way as the official [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) and [`docker exec`](https://docs.docker.com/engine/reference/commandline/exec/) commands.\n\nIn general, you can pass the same arguments to `docker-run` as you would pass to `docker run`, e.g.\n\n```bash\ndocker-run --volume $(pwd):/volume ubuntu ls /volume\n```\n\nIn addition to the arguments you are passing, `docker-run` however also enables the following features by default. Most of these default features can be disabled, see [Usage](#usage).\n- container removal after exit (`--rm`)\n- interactive tty (`--interactive --tty`)\n- current directory name as container name (`--name`)\n- relative bind mounts (`--volume [./RELATIVE_PATH>]:[TARGET_PATH]`)\n- GPU support (`--gpus all` / `--runtime nvidia`)\n- X11 GUI forwarding\n\nIf a container with matching name is already running, `docker-run` will execute a command in that container via `docker exec` instead. This lets you quickly attach to a running container without passing any command, e.g.\n\n```bash\ndocker-run --name my-running-container\n```\n\nUnlike with `docker run`, you can also set the Docker image via the `--image` arguments, see [Usage](#usage). This may be required for more complex use cases.\n\n\n## Installation\n\n```bash\npip install docker-run-cli\n\n# (optional) shell auto-completion\nsource $(activate-python-docker-run-shell-completion 2> /dev/null)\n```\n\n> **Warning**  \n> Outside of a virtual environment, *pip* may default to a user-site installation of executables to `~/.local/bin`, which may not be present in your shell's `PATH`.  If running `docker-run` errors with `docker-run: command not found`, add the directory to your path. [*(More information)*](https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-to-the-user-site)  \n> ```bash\n> echo \"export PATH=\\$HOME/.local/bin:\\$PATH\" >> ~/.bashrc\n> source ~/.bashrc\n> ```\n\n\n## Usage\n\n```\nusage: docker-run [--help] [--image IMAGE] [--mwd] [--name NAME] [--no-gpu]\n                  [--no-it] [--no-loc] [--no-name] [--no-rm] [--no-tz]\n                  [--no-x11] [--verbose] [--version]\n\nExecutes `docker run` with the following features enabled by default, each of\nwhich can be disabled individually: container removal after exit, interactive\ntty, current directory name as container name, GPU support, X11 GUI\nforwarding. Passes any additional arguments to `docker run`. Executes `docker\nexec` instead if a container with the specified name (`--name`) is already\nrunning.\n\noptional arguments:\n  --help         show this help message and exit\n  --image IMAGE  image name (may also be specified without --image as last\n                 argument before command)\n  --mwd          mount current directory at same path\n  --name NAME    container name; generates `docker exec` command if already\n                 running\n  --no-gpu       disable automatic GPU support\n  --no-it        disable automatic interactive tty\n  --no-loc       disable automatic locale\n  --no-name      disable automatic container name (current directory)\n  --no-rm        disable automatic container removal\n  --no-tz        disable automatic timezone\n  --no-x11       disable automatic X11 GUI forwarding\n  --verbose      print generated command\n  --version      show program's version number and exit\n```\n\n## Plugins\n\n`docker-run` can be extended through plugins. Plugins are installed as optional dependencies.\n\n```bash\n# install specific plugin <PLUGIN_NAME>\npip install docker-run-cli[<PLUGIN_NAME>]\n\n# install all plugins\npip install docker-run-cli[plugins]\n```\n\n| Plugin | Description |\n| --- | --- |\n| [`docker-ros`](https://pypi.org/project/docker-run-docker-ros) | extra functionality for Docker images built by [*docker-ros*](https://github.com/ika-rwth-aachen/docker-ros) |\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Institute for Automotive Engineering (ika), RWTH Aachen University  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "'docker run' and 'docker exec' with useful defaults",
    "version": "0.9.7",
    "project_urls": {
        "Bug Tracker": "https://github.com/ika-rwth-aachen/docker-run/issues",
        "Repository": "https://github.com/ika-rwth-aachen/docker-run"
    },
    "split_keywords": [
        "docker",
        " container"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebf0c6799bdbe4517009123c7e186835c340b7e393ea9fac36f772ccab3bb1e6",
                "md5": "5deb6cb6a22c02e4b68d657226923644",
                "sha256": "99dd78f8da832b61372a10fbb9d58fe8d728a6492eb0d440cb4d3ae0bf5f7113"
            },
            "downloads": -1,
            "filename": "docker_run_cli-0.9.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5deb6cb6a22c02e4b68d657226923644",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 14192,
            "upload_time": "2024-04-09T11:31:12",
            "upload_time_iso_8601": "2024-04-09T11:31:12.515201Z",
            "url": "https://files.pythonhosted.org/packages/eb/f0/c6799bdbe4517009123c7e186835c340b7e393ea9fac36f772ccab3bb1e6/docker_run_cli-0.9.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc5e8cc6c1cc7c4c5f07c0d35229394e0ad6e7835e45ea9e6240ae0353078262",
                "md5": "dbb3a9d3b5b882b1a5860d7c98fa9d14",
                "sha256": "429ff531517a39f2cd039380f0af94c0aa79c48a05df7f84fe08b490f78c2a31"
            },
            "downloads": -1,
            "filename": "docker-run-cli-0.9.7.tar.gz",
            "has_sig": false,
            "md5_digest": "dbb3a9d3b5b882b1a5860d7c98fa9d14",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 14402,
            "upload_time": "2024-04-09T11:31:14",
            "upload_time_iso_8601": "2024-04-09T11:31:14.207977Z",
            "url": "https://files.pythonhosted.org/packages/dc/5e/8cc6c1cc7c4c5f07c0d35229394e0ad6e7835e45ea9e6240ae0353078262/docker-run-cli-0.9.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-09 11:31:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ika-rwth-aachen",
    "github_project": "docker-run",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "docker-run-cli"
}
        
Elapsed time: 0.22552s