Git Product home page Git Product logo

dockit's Introduction

dockit: Overlay a Docker image onto the current directory

$ touch file1 file2
$ ls
file1  file2
$ dockit alpine
Using default tag: latest
latest: Pulling from library/alpine
Digest: sha256:72c42ed48c3a2db31b7dafe17d275b634664a708d901ec9fd57b1529280f01fb
Status: Image is up to date for alpine:latest
docker.io/library/alpine:latest
/docked # ls
file1  file2

Features

  • Seamless but separated: Changes in the /docked directory stay local to the container, letting you install, delete, and otherwise make a mess of things without harming the real directory.
  • Consistent permissions: dockit tries to set the ownership of files in the docked directory to a sensible user. This defaults to the USER specified in the image, if any, and root if not.
  • Easy export: The undock command exports files you select back to the host.

Caveats

  • To allow for the exporting of files, the /host directory is mounted read-write. Changes inside that directory will impact the real host directory. Maybe don’t rm -rf /.
  • To fix permissions, dockit runs a recursive chown on the overlay filesystem in /docked. If you dockit from a large directory, this could take a while. If your version of overlayfs doesn’t support the metaonly mount option, this will take even longer, and will result in a temporary copy of all the files in that directory inside a Docker volume.

Installation

git clone https://github.com/awkspace/dockit
cd dockit
sudo ./install.sh

The included installer script will install dockit to /usr/local. If that doesn’t meet your needs, you can also run it directly from the cloned copy as bin/dockit.

Usage

dockit - Run a Docker image overlaid on the current directory

Usage: dockit [options] <image>

Options:
-h         this help text
-d         detach; run in background, useful for scripting
-l         log session with script
-n         no mount; just run the image
-i         skip ignores; do not remove files ignored by VCS or Docker
-m <user>  mount directory as <user> instead of default
-r <user>  run shell as <user> instead of default
-u         update image before mounting

Exporting

If you’ve produced something inside the container that you’d like to move back to the host, you can do so using the undock command from within the container.

/docked # undock
Usage: undock <file1> [<file2>]...

License

dockit, such as it is, is licensed under MIT.

dockit's People

Contributors

awkspace avatar tyler71 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.