Linux containers in 500 lines of code (2016)
blog.lizzie.io
Linux containers in 500 lines of code (2016)
1–10 of 31 posts
Re: Linux containers in 500 lines of code (2016)
#2Re: Linux containers in 500 lines of code (2016)
#3Re: Linux containers in 500 lines of code (2016)
#4Docker in ~100 lines of bash: https://github.com/p8952/bocker
Re: Linux containers in 500 lines of code (2016)
#5Re: Linux containers in 500 lines of code (2016)
#6Re: Linux containers in 500 lines of code (2016)
#7Docker in ~100 lines of bash: https://github.com/p8952/bocker
"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
Re: Linux containers in 500 lines of code (2016)
#8Earlier quoted context omitted.
"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
Only the first few lines of the script look dense. Everything else looks normal to me.
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}'
)"Re: Linux containers in 500 lines of code (2016)
#9Earlier quoted context omitted.
Only the first few lines of the script look dense. Everything else looks normal to me.
Stuff like 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}' )"
Re: Linux containers in 500 lines of code (2016)
#10Earlier quoted context omitted.
Only the first few lines of the script look dense. Everything else looks normal to me.
Stuff like 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}' )"
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.