4 ms·
Docker in ~100 lines of bash: https://github.com/p8952/bocker https://github.com/p8952/bocker
by arpa 7y ago
Docker in ~100 lines of bash: https://github.com/p8952/bocker https://github.com/p8952/bocker
- VWWHFSfQ 7y ago"100 lines of bash" is pretty generous. they might as well have just made it 1 line of bash with the way the code is written
- _zer0 7y agoOnly the first few lines of the script look dense. Everything else looks normal to me.
- fwip 7y agoStuff like https://github.com/p8952/bocker/blob/master/bocker#L94 https://github.com/p8952/bocker/blob/master/bocker#L94 is super dense. I might write that something like: cid="$( ps o ppid,pid | grep "^$( ps o pid,cmd | grep -E "^\ *[0-9]+ unshare.*$1" | awk '{print $1}' )" | awk '{print $2}' )"
- Hello71 7y agoor maybe even cid=$(pgrep -P $(pgrep -f "unshare.*$1")).
- stingraycharles 7y agoI agree with you that their code is fairly dense, yours is overly verbose. Having said that, looking at their code, I don’t get the impression they’re optimizing for LOC. There is plenty of verbosity and opportunity to remove lines of code if they wanted.
- cyansmoker 7y agoCan confirm. The bocker code (incl. my modest contributions) was targeted towards showing that the Linux toolbox was available and scriptable.
- travbrack 7y agoMaybe I've spent too much time writing one-liners in bash but I really prefer the original to yours. I can read the original much faster because it matches the pattern for how I write bash on the command line. Yours looks totally foreign to how bash is normally written. Not saying one is better than the other, just my personal preference.
- fwip 7y agoDang, didn't expect the downvotes for sharing my bash coding style. :(
- SahAssar 7y agoThat's not fair considering the two longest lines are for logging into dockerhub and parsing input arguments.
- lproven 7y agoExactly... I mentioned this in an article 4 years ago. https://www.theregister.co.uk/2016/07/05/containers_state_of_the_art/ https://www.theregister.co.uk/2016/07/05/containers_state_of...