Last active
December 20, 2015 07:08
-
-
Save cybersiddhu/6090684 to your computer and use it in GitHub Desktop.
Script for creating dietfs docker container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| [ -f rootfs.tar ] || { | |
| echo "Hmm this should run in the directory of rootfs.tar" | |
| exit 1 | |
| } | |
| rm -rf extra | |
| mkdir extra extra/etc extra/sbin extra/lib extra/lib64 | |
| touch extra/etc/resolv.conf | |
| touch extra/sbin/init | |
| # Uncomment this if you want to include docker in the image, for testing purposes | |
| #cp $(which docker) extra | |
| # You might have to run "ldd $(which docker)" and adjust those paths | |
| cp /lib/x86_64-linux-gnu/libpthread.so.0 /lib/x86_64-linux-gnu/libc.so.6 extra/lib | |
| cp /lib64/ld-linux-x86-64.so.2 extra/lib64 | |
| cp rootfs.tar diet.tar | |
| tar --delete -f diet.tar './sbin/init' | |
| tar --delete -f diet.tar './etc/resolv.conf' | |
| tar rf diet.tar -C extra . | |
| #docker import - cybersiddhu/dietfs < diet.tar | |
| #docker run -t -i dietfs /bin/sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment