docker-runx

module
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2024 License: MIT

README

docker run, better

           ⣀⣠⣤⢴⡶⡶⡶⣶⢶⣦⣤⣄⣀
       ⢀⣤⡈⠩⣉⣁⠁       ⠈⠉⠙⠻⢵⣤⡀
     ⣠⢾⠛⠉  ⠈⣛⡟⢷⣦⣄         ⠉⠻⡷⣄
   ⢠⣞⠏⠁    ⠠⣒⠯⣗⢮⣚⢷⣦⡀        ⠈⠻⣷⡀
  ⣰⡯⠁    ⣀⣰⢽⠲⠝⢎⣛⣊⣋⣓⣛⣂⣀        ⠘⢿⠄     ⣀⡀    __________   Docker    ____  ___
 ⣰⡟   ⢀⠤⠌⣃⣭⢶⣞⣿⣽⣾⣻⣽⣯⢿⣽⡯⠿⠶⣶⢦⣤⣤⠤⣤⣤⣤⠴⠶⠒⠚⠉⠉      \______   \__ __  ____ \   \/  /
⢠⡿   ⠐⣩⣶⣻⣽⡾⠿⠙⠓⠉⠈⠁ ⣯   ⠘⢓⣠⣴⣖⣛⣉⡡  ⠰⣾           |       _/  |  \/    \ \     /
⣸⡇  ⣠⣾⣟⠞⠋⠁⣀⣠⣤⣴⣶⡶⡦ ⠻⣄⣀ ⢨⣤⣤⠴⠖⠋⠁    ⡿⡆          |    |   \  |  /   |  \/     \
⣿⡅ ⢰⣟⠇⠁⠤⠒⠉⠉ ⣀⣀⣤⣤⣤⢶⠶⠞⠛⠛⠉⠁         ⡿⡇          |____|_  /____/|___|  /___/\  \
⣷⡇ ⣟⠃  ⢀⣠⡴⠞⠛⠉⠉⣰⡟⣠⠟     ⡀         ⡿⡇                 \/           \/      \_/
⢸⣇ ⢻⡀ ⣰⢻⡁   ⡠⠞⠉⠐⠁   ⣠⡶⠋         ⢀⢿⠃
⠈⣷⡄⠘⢧⡀⠏⠘⢷⣄⣀       ⣠⣾⠏           ⣸⡟
 ⠘⣷⡄⠈⠳⣄⡀ ⠙⠿⣻⣅⡀  ⢀⣼⢿⡞           ⣰⠿
  ⠈⢟⣦ ⢻⠻⠶⢤⣄⣀⠉⠛⠳⠶⣞⣿⣽⠁         ⢀⣴⠟⠁
    ⠙⢷⣄⡀  ⠙⠏⠙⠛⠓⠲⣶⣖⡏        ⢀⡴⡽⠋
      ⠙⠻⣦⣄⡀     ⣷⢿⡅     ⢀⣠⣴⠟⠋
         ⠙⠙⠷⣶⣤⣤⣄⠸⣟⣷⠠⣤⣤⡶⠾⠛⠉
              ⠁⠉ ⠹⣽⡄⠉
                  ⠘⢷⡀
                    ⠁

See the Docker RunX reference for more information.

Main Usage

Let's imagine you want to show your container can run a specific action. For instance echo Hello from alpine image.

Create a runx.yaml file with the following content:

actions:
  - id: hello # required, the action identifier
    type: run # required, the action type, only `run` is supported for now
    env: # a list of environment variables that needs to be set
      - USER
    cmd: --rm {{.Ref}} echo hello {{env "USER"}} # `.Ref` will be replaced by the reference the user provided

And let's create a documentation file called README.md:

# Hello!

Run the `hello` action with `docker runx` to display a message.

Now decorate the alpine image and push it under NAMESPACE/REPOSITORY:

$ docker runx decorate alpine --tag NAMESPACE/REPOSITORY

[!TIP] runx.yaml and README.md are the default file names. You can specify the file names using --with-config and --with-readme flags. It's intended to have both files, if you don't want to provide one or the other, use --no-config or --no-readme flags.

You can then display the embedded readme:

$ dockedr runx NAMESPACE/REPOSITORY --docs

Or run the hello action:

$ docker runx NAMESPACE/REPOSITORY hello

See more examples in the examples directory.

CLI Plugin Installation

Manual Installation

To install it manually:

  • Download the docker-runx binary corresponding to your platform from the latest or other releases.
  • Rename it as
    • docker-runx on Linux and macOS
    • docker-runx.exe on Windows
  • Copy the binary to the runx directory (you might need to create it)
    • $HOME/.docker/runx on Linux and macOS
    • %USERPROFILE%\.docker\runx on Windows
  • Make it executable on Linux and macOS
    • chmod +x $HOME/.docker/runx/docker-runx
  • Authorize the binary to be executable on macOS
    • xattr -d com.apple.quarantine $HOME/.docker/runx/docker-runx
  • Add the runx directory to your .docker/config.json as a plugin directory
    • $HOME/.docker/config.json on Linux and macOS
    • %USERPROFILE%\.docker\config.json on Windows
    • Add the cliPluginsExtraDirs property to the config.json file
{
	...
	"cliPluginsExtraDirs": [
		"<full path to the .docker/runx folder>"
	],
	...
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL