Boot2Docker migration on osx

This commit is contained in:
Jeffrey Morgan 2015-08-06 17:40:20 -07:00
parent 51fa7d0c42
commit 5ba84fb37c
6 changed files with 54 additions and 9 deletions

View File

@ -91,6 +91,8 @@ RUN cd /mpkg/docker.pkg && \
# dockermachine.pkg # dockermachine.pkg
RUN cd /mpkg/dockermachine.pkg && \ RUN cd /mpkg/dockermachine.pkg && \
cd Scripts && find . | cpio -o --format odc | gzip -c > ../Scripts.bin && cd .. && \
rm -r Scripts && mv Scripts.bin Scripts && \
mkdir rootfs && \ mkdir rootfs && \
cd rootfs && \ cd rootfs && \
mkdir -p usr/local/bin && \ mkdir -p usr/local/bin && \

View File

@ -18,9 +18,6 @@
<choice id="choiceDockerCLI" title="choiceDockerCLI_title" description="choiceDockerCLI_msg" start_selected="true" start_enabled="true" start_visible="true"> <choice id="choiceDockerCLI" title="choiceDockerCLI_title" description="choiceDockerCLI_msg" start_selected="true" start_enabled="true" start_visible="true">
<pkg-ref id="io.docker.pkg.docker"/> <pkg-ref id="io.docker.pkg.docker"/>
</choice> </choice>
<choice id="choiceDockerMachineCLI" title="choiceDockerMachineCLI_title" description="choiceDockerMachineCLI_msg" start_selected="true" start_enabled="true" start_visible="true">
<pkg-ref id="io.docker.pkg.dockermachine"/>
</choice>
<choice id="choiceDockerComposeCLI" title="choiceDockerComposeCLI_title" description="choiceDockerComposeCLI_msg" start_selected="true" start_enabled="true" start_visible="true"> <choice id="choiceDockerComposeCLI" title="choiceDockerComposeCLI_title" description="choiceDockerComposeCLI_msg" start_selected="true" start_enabled="true" start_visible="true">
<pkg-ref id="io.docker.pkg.dockercompose"/> <pkg-ref id="io.docker.pkg.dockercompose"/>
</choice> </choice>
@ -34,10 +31,6 @@
<pkg-ref id="io.docker.pkg.docker"> <pkg-ref id="io.docker.pkg.docker">
<bundle-version/> <bundle-version/>
</pkg-ref> </pkg-ref>
<pkg-ref id="io.docker.pkg.dockermachine" auth="Root" version="%DOCKERMACHINE_VERSION%" installKBytes="%DOCKERMACHINE_INSTALL_KBYTES%">#dockermachine.pkg</pkg-ref>
<pkg-ref id="io.docker.pkg.dockermachine">
<bundle-version/>
</pkg-ref>
<pkg-ref id="io.docker.pkg.dockercompose" auth="Root" version="%DOCKERCOMPOSE_VERSION%" installKBytes="%DOCKERCOMPOSE_INSTALL_KBYTES%">#dockercompose.pkg</pkg-ref> <pkg-ref id="io.docker.pkg.dockercompose" auth="Root" version="%DOCKERCOMPOSE_VERSION%" installKBytes="%DOCKERCOMPOSE_INSTALL_KBYTES%">#dockercompose.pkg</pkg-ref>
<pkg-ref id="io.docker.pkg.dockercompose"> <pkg-ref id="io.docker.pkg.dockercompose">
<bundle-version/> <bundle-version/>
@ -159,4 +152,19 @@
<pkg-ref id="io.boot2dockeriso.pkg.boot2dockeriso"> <pkg-ref id="io.boot2dockeriso.pkg.boot2dockeriso">
<bundle-version/> <bundle-version/>
</pkg-ref> </pkg-ref>
<pkg-ref id="io.docker.pkg.dockerquickstartterminalapp" auth="Root" version="%DOCKERQUICKSTARTTERMINALAPP_VERSION%" installKBytes="%DOCKERQUICKSTARTTERMINALAPP_INSTALL_KBYTES%">#dockerquickstartterminalapp.pkg</pkg-ref>
<pkg-ref id="io.docker.pkg.dockerquickstartterminalapp">
<bundle-version/>
</pkg-ref>
<pkg-ref id="io.docker.pkg.kitematicapp" auth="Root" version="%KITEMATICAPP_VERSION%" installKBytes="%KITEMATICAPP_INSTALL_KBYTES%">#kitematicapp.pkg</pkg-ref>
<pkg-ref id="io.docker.pkg.kitematicapp">
<bundle-version/>
</pkg-ref>
<choice id="choiceDockerMachineCLI" title="choiceDockerMachineCLI_title" description="choiceDockerMachineCLI_msg" start_selected="true" start_enabled="true" start_visible="true">
<pkg-ref id="io.docker.pkg.dockermachine"/>
</choice>
<pkg-ref id="io.docker.pkg.dockermachine" auth="Root" version="%DOCKERMACHINE_VERSION%" installKBytes="%DOCKERMACHINE_INSTALL_KBYTES%">#dockermachine.pkg</pkg-ref>
<pkg-ref id="io.docker.pkg.dockermachine">
<bundle-version/>
</pkg-ref>
</installer-gui-script> </installer-gui-script>

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
VM=docker-vm VM=default
DOCKER_MACHINE=/usr/local/bin/docker-machine DOCKER_MACHINE=/usr/local/bin/docker-machine
BLUE='\033[0;34m' BLUE='\033[0;34m'

View File

@ -7,4 +7,3 @@ chown -R $USER:staff ~/.docker
curl -H "Content-Type: application/json" -X POST "https://api.mixpanel.com/track/?data=%EVENT_DATA%" curl -H "Content-Type: application/json" -X POST "https://api.mixpanel.com/track/?data=%EVENT_DATA%"
# TODO: run migration

View File

@ -7,4 +7,7 @@
<atomic-update-bundle/> <atomic-update-bundle/>
<strict-identifier/> <strict-identifier/>
<relocate/> <relocate/>
<scripts>
<postinstall file="./postinstall"/>
</scripts>
</pkg-info> </pkg-info>

View File

@ -0,0 +1,33 @@
#!/bin/bash
ls -al ~/.docker/machine/cache/
# Migrate Boot2Docker VM
BOOT2DOCKER_VM=boot2docker-vm
VM=default
sudo -u $USER /usr/local/bin/VBoxManage showvminfo $BOOT2DOCKER_VM &> /dev/null
BOOT2DOCKER_VM_EXISTS_CODE=$?
sudo -u $USER /usr/local/bin/VBoxManage showvminfo $VM &> /dev/null
VM_EXISTS_CODE=$?
# Exit if there's no boot2docker vm, or the destination VM already exists
if [ $BOOT2DOCKER_VM_EXISTS_CODE -ne 0 ] || [ $VM_EXISTS_CODE -eq 0 ]; then
exit 0
fi
osascript -e 'tell app "System Events" to display dialog "Migrate your existing Boot2Docker VM to work with the Docker Toolbox?\n \nYour existing Boot2Docker VM will not be affected. This should take about a minute." buttons {"Do not Migrate", "Migrate"} default button 2 cancel button 1 with icon 2 with title "Migrate Boot2Docker VM?"'
if [ $? -eq 0 ]; then
rm -rf ~/.docker/machine/machines/default
sudo -u $USER PATH=/Applications/VirtualBox.app/Contents/MacOS/:$PATH bash -c "/usr/local/bin/docker-machine -D create -d virtualbox --virtualbox-import-boot2docker-vm $BOOT2DOCKER_VM $VM" 2>&1 | sed -e '/BEGIN/,/END/d' > /tmp/toolbox-migration-logs.txt
if [ $? -ne 0 ]; then
osascript -e 'tell app "System Events" to display dialog "Boot2Docker VM migrated successfully to a Docker Machine VM named \"default\"" buttons {"Ok"} default button 1'
else
osascript -e 'tell app "System Events" to display dialog "Could not migrate the Boot2Docker VM. Please file an issue with the migration logs at https://github.com/docker/machine/issues/new." buttons {"Cancel", "View Migration Logs"} default button 2 cancel button 1 with icon 0 with title "Migration Failed"'
if [ $? -eq 0 ]; then
open -a TextEdit /tmp/toolbox-migration-logs.txt
fi
exit 1
fi
fi