{"id":19042839,"url":"https://github.com/omni-us/docker-command-line-interface","last_synced_at":"2025-04-23T22:29:45.656Z","repository":{"id":66135699,"uuid":"157964033","full_name":"omni-us/docker-command-line-interface","owner":"omni-us","description":"Script intended to ease the execution from the command line of commands inside docker containers","archived":false,"fork":false,"pushed_at":"2022-12-12T09:40:35.000Z","size":14,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-18T07:51:45.752Z","etag":null,"topics":["bash","cli","docker","shell"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omni-us.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-17T08:09:33.000Z","updated_at":"2024-04-30T16:32:10.000Z","dependencies_parsed_at":"2023-03-13T20:30:44.009Z","dependency_job_id":null,"html_url":"https://github.com/omni-us/docker-command-line-interface","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omni-us%2Fdocker-command-line-interface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omni-us%2Fdocker-command-line-interface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omni-us%2Fdocker-command-line-interface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omni-us%2Fdocker-command-line-interface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omni-us","download_url":"https://codeload.github.com/omni-us/docker-command-line-interface/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250526076,"owners_count":21445127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","cli","docker","shell"],"created_at":"2024-11-08T22:39:09.231Z","updated_at":"2025-04-23T22:29:45.648Z","avatar_url":"https://github.com/omni-us.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nVersion: 2022.12.12\n\nDESCRIPTION\n===========\n\n  This is a simple script intended to ease the execution from the command line\n  of commands inside docker containers. It makes the execution behave mostly\n  like any other host command. The main characteristics are:\n\n  - Automatic access to user files in the host.\n  - Generated files owned by the current user.\n  - Support input from stdin and redirection of stderr and stdout.\n  - Support of complex command arguments, e.g. spaces, quotes, etc.\n\n  The basic system requirement is that docker must be installed and configured\n  to not require sudo.\n\n  A new container is created for each call to docker-cli and\n  when execution finishes the container is automatically removed. The command is\n  executed as the current user from the current working directory. Executed\n  commands will only work if it is executed from and referencing only files in\n  the host's /Users, /home, /mnt, /media or /tmp directories.\n\n  The interface can also be used to execute external scripts inside the\n  container. For this to work, the script must be located in a directory\n  accessible to the container (see above) and be in a directory in your $DPATH\n  environment variable or be referenced with its full or relative path.\n\n\nINSTALLATION\n============\n\n  By installation it is meant to make the docker-cli\n  command runnable from any location. If you cloned the github repository, it is\n  recommended that you create a symlink from the clone to any directory in your\n  path, i.e.\n\n    cd $HOME/.local/bin\n    ln -s path_to_repo/docker-cli\n\n  Copying the script to any directory in your path would also work.\n\n  **Bash completion:**\n\n  It is very useful to enable bash completion for example to ease typing of\n  image names and tags. This can be enabled by sourcing the script, though this\n  functionality depends on the docker bash completion, so this one needs to be\n  enabled first. To make it permanent you could add to your .bashrc the\n  following (adapting to your case):\n\n    source /usr/share/bash-completion/completions/docker\n    source $HOME/.local/bin/docker-cli\n\n\nSYNOPSIS\n========\n\n    docker-cli [OPTIONS] -- DOCKER_IMAGE COMMAND ARGUMENTS\n    docker-cli [OPTIONS] -- DOCKER_IMAGE bash   # Prompt becomes USER_ID@CONTAINER_ID$\n\n\nOPTIONS\n=======\n\n    --add-uid                 Run add_uid_to_passwd at startup.\n    --tmp-home                Create /tmp/HOME directory and set HOME=/tmp/HOME.\n    --user UID:GID            (default: current user and current directory's group)\n    --gpus=GPUS               (e.g. all)\n    --ipc=DOCKER_IPC          (e.g. host)\n    --publish=LIST            (e.g. 8080:8080)\n    --cli-debug               Prints the docker run command right before execution.\n    --help                    Prints this help message and exits.\n    --version                 Prints the version of docker-cli and exits.\n\n  In general most of the options that docker run accepts should work. For more\n  details check docker run --help.\n\n\nEXAMPLES\n========\n\n    # Get the version of some command in the container\n    docker-cli -- ubuntu:16.04 sed --version\n\n    # Container command as part of a pipe\n    echo 'hello world!' | docker-cli -- ubuntu:16.04 grep hello | xargs echo\n\n    # Create files in container\n    echo 'hello world!' | docker-cli -- ubuntu:16.04 tee test.txt\n    ls -l test.txt\n    rm test.txt\n\n    # Use of nvidia GPU in container\n    docker-cli --runtime=nvidia -- nvidia/cuda:10.1-runtime-ubuntu16.04 nvidia-smi  # old format\n    docker-cli --gpus=all -- nvidia/cuda:10.1-runtime-ubuntu16.04 nvidia-smi\n\n    # Run a jupyter notebook in container\n    docker-cli --publish=8888:8888 -- DOCKER_IMAGE bash\n    export HOME=$(pwd)\n    jupyter notebook --ip 0.0.0.0 --no-browser\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomni-us%2Fdocker-command-line-interface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomni-us%2Fdocker-command-line-interface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomni-us%2Fdocker-command-line-interface/lists"}