Search code examples
dockerboot2docker

boot2docker: bootlocal.sh not executing


I'm trying to do some customization on my boot2docker vm, and from what I can tell, I should be able to add a file: /var/lib/boot2docker/bootlocal.sh which should be executed when boot2docker starts, but it never seems to execute.

Here's my bootlocal.sh just to try to get it working:

!/bin/sh

echo 'testing bootlocal'
touch /var/lib/boot2docker/testfile

And I'm running boot2docker on OSX with this version info:

$ boot2docker version
Boot2Docker-cli version: v1.4.1
Git commit: 43241cb

I've also run chmod +x /var/lib/boot2docker/bootlocal.sh in case that script needs to be made executable.

I've tried both boot2docker restart and boot2docker down/up

Any idea what I may be missing?


Solution

  • You need to set up a persistence partition with the volume name boot2docker-data.

    1. Add a new virtual disk to your VM.

    2. Create a new partition on the virtual disk using fdisk.

    3. Format the partition as ext4 - mkfs.ext4 -L boot2docker-data /dev/sdX1

    4. Reboot boot2docker and it will pick up the persistence partition.