ch: container helper [WIP]
WARNING
This project is not yet in a usable state. I am leaving this open for visibility and comments on the general
design. Unfortunately there is not an easy way to install this... yet. Once development has finished, I will provide a
release. Until then, you'll have to run make
and using the executable. Thanks!
A simple Docker interface to manage multiple containerized development environments. Provides a simple shell environment for separate development environments designed to use for C++ development in CSCI 104 but portable enough to use whichever Docker container you choose.
Status
-
create ENVIRONMENT
create new environment config
- replace if it already exists
- build image from Dockerfile
- pull image from Docker repository
- support volume mounts and path checking on Windows and macOS
-
delete ENVIRONMENT
delete environment
-
start ENVIRONMENT
run container in background
-
shell ENVIRONMENT
start shell in container
- run commands in container
- attach interactive terminal to container
- attach volumes to containers
- MVP on Windows
- MVP on macOS/Unix
- add options for debugging in containers
- security options (
seccomp:unconfined
)
- add capacities (
SYS_PTRACE
)
-
stop ENVIRONMENT
shutdown running container
-
list [CONTAINER]
list container environment details, no args prints all details
- list mounted directories
- list container source
-
unit tests
-
create
-
delete
-
start
-
shell
-
stop
-
list
Spec
# create environment
ch create ENVIRONMENT_NAME {--file DOCKERFILE|--image DOCKER_IMAGE} [--volume PATH_TO_DIRECTORY] [--shell SHELL_CMD]
ch create --file ./env/Dockerfile --shell /bin/bash --volume ./project/files/ --name cs104
# start container
# [docker run]
ch start cs104
# get shell into environment
# [docker exec]
ch shell cs104
# stop container
ch stop cs104
# list all environments
ch list
# set default container when you don't provide any args
ch --set-default cs104
create
create docker environment, specify Dockerfile to build or image to pull
start
start docker container in background and save container id to config file
shell
run docker shell in docker environment
stop
stop running container/environment
list
list all saved configs
Development
Install cobra dependencies: (required to generate new commands)
go get github.com/spf13/cobra/cobra
Add new cobra command
# add new subcommand
cobra add <child command> -p <parent command>
cobra add childCommand -p 'parentCommand'
Add or adjust ~/.cobra.yaml
file for your name, license, year, etc. Docs
Go Module:
# already created
go mod init github.com/<name>/<repo-name>
# add new library
go get <new dependency>
# organize modules and dependencies
go mod tidy
# remove dependency
go mod edit -dropreplace github.com/go-chi/chi
Write Documentation:
Follow syntax recommended by google developer docs
Change package name:
# change module name in all files
find . -type f \( -name '*.go' -o -name '*.mod' \) -exec sed -i -e "s;container-helper;ch;g" {} +