Giter VIP home page Giter VIP logo

boxer's Introduction

๐ŸฅŠ Boxer

Instantly launch an ephemeral Docker container from your terminal with just one function in your .bashrc or .zshrc file.

Why?

I was inspired by Distrobox and wanted to create a solution that works on macOS. Boxer creates ephemeral Linux environments for testing or other purpose, and is designed for developers, pentesters, and hobbyists alike.

Boxer is not meant to replace Distrobox. Instead, it provides a lightweight way to launch ephemeral containers of any Docker image.

Differences between Distrobox and Boxer

Boxer can...

  • Create and dismantle ephemeral containers of any Docker image
  • Access files and folders from the directory where the container was launched

Boxer cannot...

  • Leave containers running in the background
  • Persist changes made to its containers (planned)
  • Use Wayland or X11 sockets
  • Use networking features (planned)
  • Mount removable devices
  • Tell you a love story

Key Features

  • Launches an interactive Docker container running the specified OS or image
  • Automatically removes the container after use
  • Includes a bind mount to your current working directory in /host
  • Optionally run a specific command or shell in the container
  • ๐Ÿ†• Supports image tags
  • No additional software required
  • Likely works with podman using an alias (untested)

Setup

Add this code to your .bashrc or .zshrc file, then restart your terminal:

boxer() {
  # setup vars
  IMAGE=$1
  IFS=':' read -r IMAGE_NAME IMAGE_VERSION <<< "$IMAGE"

  if [ -z "${IMAGE_VERSION}" ]; then
    docker run -it --rm --mount type=bind,source="$(pwd)",target=/host --hostname "$0"-"$IMAGE_NAME" "$IMAGE_NAME" ${@:2}
  else
    docker run -it --rm --mount type=bind,source="$(pwd)",target=/host --hostname "$0"-"$IMAGE_NAME" "$IMAGE_NAME":"$IMAGE_VERSION" ${@:2}
  fi
}

Usage and Examples

Launch a container with the boxer command like this:

boxer <image_name>[:image_tag] [command]

Then, find the files from the directory in which you launched the container in the bind mount location: /host.

Examples

Example Command
Whip up an Ubuntu container boxer ubuntu
Drop into a shell within the node image boxer node bash
Target a specific image tag boxer rockylinux:9

boxer's People

Contributors

yeenbean avatar

Stargazers

Joshua avatar

Watchers

 avatar

boxer's Issues

Introduce support for tags

Some operating system images, like Rocky Linux, intentionally do not have a latest tag. Therefore, tag support needs to be implemented in boxer in some way.

Alternative method for installing and updating Boxer

Currently, users install Boxer by adding it to their .zshrc or .bashrc files. However, this approach makes it difficult to deliver updates to users.

Consider an alternative method to integrate Boxer with the shell that enables easier updates for users. Additionally, it would be beneficial if Boxer could check for and automatically apply updates from the repository where it is installed.

Add support for forwarding ports

Here's a simple example of how ports could be processed:

boxer -p 4100 <image_name>[:image_tag] [command to run in container]

However, the goal with Boxer is to keep things simple and straightforward. One possible approach is to only define the port as -p 4100, and then assume that both internal and public ports are identical. This idea will require further exploration.

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.