Skip to content

Instantly share code, notes, and snippets.

@so0k
Last active October 8, 2015 04:39
Show Gist options
  • Save so0k/d4f5e485a81ca5768643 to your computer and use it in GitHub Desktop.
Save so0k/d4f5e485a81ca5768643 to your computer and use it in GitHub Desktop.
shell script to setup a shared folder with host system & pull some useful tools
#create data directory to contain any data we want persisted
sudo mkdir /var/lib/boot2docker/data && sudo chown docker:staff /var/lib/boot2docker/data
#pull busybox and set it up as a data volume container
docker run -v /var/lib/boot2docker/data:/data --name data-share busybox true
#pull svendowideit/samba and run it with the data-share container
#docker run --rm -v $(which docker):/docker -v /var/run/docker.sock:/docker.sock svendowideit/samba data-share
#make sure the samba share runs next time boot2docker starts
echo "docker run --rm -v $(which docker):/docker -v /var/run/docker.sock:/docker.sock svendowideit/samba data-share" | sudo tee -a /var/lib/boot2docker/bootlocal.sh
#make bootlocal.sh executable
sudo chmod +x /var/lib/boot2docker/bootlocal.sh
#run the samba-server (this will pull it and run it, can take a while to pull)
/var/lib/boot2docker/bootlocal.sh
#get ns-enter - see https://github.com/jpetazzo/nsenter#whats-that-docker-enter-thing
docker run --rm -v /var/lib/boot2docker/:/target jpetazzo/nsenter
#get docker-enter
#this comes with jpetazzo/nsenter already - commented out
#sudo curl -Lo /var/lib/boot2docker/docker-enter https://raw.githubusercontent.com/jpetazzo/nsenter/master/docker-enter
#remove image after getting docker-enter(330 mb)
docker rmi jpetazzo/nsenter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment