databio / bulker

Manager for multi-container computing environments
https://bulker.io
BSD 2-Clause "Simplified" License
24 stars 2 forks source link

bulker shell #8

Closed nsheff closed 5 years ago

nsheff commented 5 years ago

I want to bulker shell command to start a shell in the container that is used to execute command.

nsheff commented 5 years ago

all this requires is replacing command with bash in the executable file. but this is created by load, not on the fly... so I'd possibly need to create 2 of them. can't really do an in-place sub because I've lost the template annotation of what the variables are (what if command is volume?).

I do:

nsheff commented 5 years ago

On the dev branch you can now do _command after activating a crate, to enter a shell within the appropriate container.

For example:

bulker activate demo
_fortune

you are now inside a shell of a container from the image that would be used to run the 'fortune' command.

For example:

# verify that fortune and cowsay are not installed locally:
nsheff@puma:~$ fortune
The program 'fortune' is currently not installed. You can install it by typing:
sudo apt install fortune-mod
nsheff@puma:~$ cowsay
The program 'cowsay' is currently not installed. You can install it by typing:
sudo apt install cowsay
# activate demo crate, which provides these two images
nsheff@puma:~$ bulker activate demo
Bulker config: /home/nsheff/Dropbox/env/bulker_config/puma.yaml
Activating bulker crate: demo

nsheff@puma:~$ fortune | cowsay
 ________________________________________
/ Caution: breathing may be hazardous to \
\ your health.                           /
 ----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
# Enter into a shell in the forune image. You can't run cowsay now, but can run fortune:
nsheff@puma:~$ _fortune
nsheff@puma:~$ cowsay
bash: cowsay: command not found
nsheff@puma:~$ fortune
Condense soup, not books!
# exit that container, and enter the cowsay container with _cowsay:
nsheff@puma:~$ exit
nsheff@puma:~$ _cowsay
nsheff@puma:~$ fortune
bash: fortune: command not found
nsheff@puma:~$ cowsay "boo"
 _____
< boo >
 -----
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
nsheff commented 5 years ago

this is a useful container debugging tool that is super convenient.

nsheff commented 5 years ago

(not yet working with singularity)

now works with singularity, too!

nsheff commented 5 years ago

solved in v 0.3.0