| Crates.io | container-run |
| lib.rs | container-run |
| version | 0.6.0 |
| created_at | 2021-12-27 03:13:04.453616+00 |
| updated_at | 2022-12-31 21:56:46.004193+00 |
| description | An opinionated wrapper for running commands in containers |
| homepage | https://gitlab.com/elmiko/container-run |
| repository | https://gitlab.com/elmiko/container-run |
| max_upload_size | |
| id | 503541 |
| size | 76,860 |
An opinionated wrapper for running commands in containers. container-run automates the mechanics of associating directories with container images and working directories to run commands within those containers.
The container-run binary will attempt to find a container engine
(podman then docker) in the path, and then run any arguments after the
command (eg container-run /bin/run --this=stuff --inside=container) inside a
container that will have the current directory mounted inside with read/write
privileges. In this manner a container environment can be used to read and
write files on the host filesystem, while a configuration file organizes
common container options.
Install from crates.io using cargo.
cargo install container-runCreate a file in one of three locations:
./.container-run.conf~/.container-run.conf~/.config/container-run/container-run.conf{
"basenames": {
"myproject": {"profile": "golang-github"}
},
"profiles": {
"golang-github": {
"image": "docker.io/library/golang:1.16",
"mountpoint": "/go/src/github.com/{basename}"
}
}
}
See the container-run.conf documentation for more detailed information.
Most frequently, container-run is used to execute software development oriented commands within the scope of a container that has been constructed to provide all the necessary build tools.
Change directory to the path you would like to execute commands within a
container, and execute the commands by prefixing them with container-run
(eg $ container-run make test build).
With a working directory of /home/me/myproject, and the configuration
file from the configuration file section, running the
command container-run make test will do the following:
docker.io/library/golang:1.16/home/me/myproject/ into the container as /go/src/github.com/myproject/go/src/github.com/myprojectmake testTo enable debug log printing to the terminal, and a local container-run.log
file, set the environment variable CONTAINER_RUN_VERBOSITY=debug in your
shell before executing.