Skip to content

Instantly share code, notes, and snippets.

@tef
Created August 20, 2017 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tef/4a7b5249fb1d86c9c4a550b590bcdc0b to your computer and use it in GitHub Desktop.
Save tef/4a7b5249fb1d86c9c4a550b590bcdc0b to your computer and use it in GitHub Desktop.
#!/bin/bash -x
PID=`docker run -v $(pwd):/workdir -d --privileged -i --rm ubuntu /bin/bash`
docker exec $PID apt-get -q -y update
docker exec $PID apt-get -q -y install debootstrap
docker exec $PID debootstrap --arch amd64 xenial /rootfs http://archive.ubuntu.com/ubuntu
docker exec $PID cp -r /rootfs/ /workdir
echo exit | docker attach $PID
echo "Dockerfile" > rootfs/.dockerignore
echo "FROM scratch
ADD / ." > rootfs/Dockerfile
cd rootfs
docker build -t "rootfs" .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment