Skip to content
/ moor Public

Package manager that adds commands from docker images to the host

Notifications You must be signed in to change notification settings

guziks/moor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 

Repository files navigation

About

Package manager that adds commands from docker images to the host.

Install

Prerequisites: docker, bash, curl, grep.

$ eval "$(curl -fsSL https://raw.githubusercontent.com/guziks/moor/master/install)"

Update

$ moor selfupdate

Usage

Lets imagine you want to use asciidoctor-pdf application, but do not want to install all dependencies. Luckily there is an image for that. Here is how it can be installed with moor:

$ moor asciidoctor/docker-asciidoctor ad-pdf asciidoctor-pdf

This will create small launcher $MOORBIN/ad-pdf and finish immediately. This way asciidoctor-pdf is now awailable on the host as ad-pdf. As soon as ad-pdf is launched, docker image will get downloaded and asciidoctor-pdf will get run inside a container. Container runs with --rm option, so when asciidoctor-pdf exits, container is removed.

Updating is a breeze:

$ moor up ad-pdf

When you no longer need an app, just:

$ moor rm ad-pdf

Launcher and corresponding docker image will be removed.

For more usage information see:

$ moor --help

Shell

Before installing commands, it is convenient to install shell and explore what it is in that image. Quick way to install shell:

$ moor <image>

This will create launcher <image>-shell which will run bash. If an image does not have bash, you can always install any shell in the usual way, for example:

$ moor node:alpine node-shell ash 

Portability

Once created, launchers have no dependencies but docker, so they could be copied to other systems and they'll work just fine.

File system

Installed commands run inside a container, so file system access is limited. This directories are available:

  • current working directory (determined using $PWD)
  • directory specified by ~/$MOORHOME (by default: ~/.moor/home)

Note: MOORHOME is part of the path, relative to users HOME.

Network

On Linux, docker network type host is used, so all ports are automatically available. On Mac this type of network is not available, so you need to explicitly make port forwarding while launching installed command:

$ MRUN="-p <port>:<port> [-p <port>:<port> ...]" <cmd> <args>

For example:

$ MRUN="-p 8080:8080" python -m http.server 8080

Notice how docker ports syntax used inside MRUN variable.

Docker run

You can use MRUN variable to supply any additional docker run options, for example:

$ MRUN="--env URL=http://example.com" node app.js

There must be no spaces inside environmnent variables supplied this way.

TIP: If you need environment variables with spaces inside, use MRUN="--env-file <file-name>".

Troubleshooting

If installed command or even shell does not work as expected, try to install the command with one or several of these options:

  1. --privileged
  2. --keep-user
  3. --keep-home
  4. --user=<name>

If --keep-user helped then consider installing the command with both --keep-user and --chown options. See moor install --help.

About

Package manager that adds commands from docker images to the host

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages