mirror of https://github.com/docker/docs.git
Improve Toolbox to Desktop migration (#11297)
* Improve Toolbox to Desktop migration Previously we recommended converting the disk at the block level. This is a bit risky as any on-disk format change could prevent it from working. It's safer to explicitly `docker commit`, then `docker save` and `docker load` containers and images. Signed-off-by: David Scott <dave.scott@docker.com> * Minor style updates * Minor style updates Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com>
This commit is contained in:
parent
9df2ab4aaf
commit
c9f8d88959
|
@ -167,49 +167,31 @@ machines. One solution is to use a version manager like
|
||||||
|
|
||||||
Docker Desktop does not propose Toolbox image migration as part of its
|
Docker Desktop does not propose Toolbox image migration as part of its
|
||||||
installer since version 18.01.0. You can migrate existing Docker
|
installer since version 18.01.0. You can migrate existing Docker
|
||||||
Toolbox images with the scripts described below. (This migration
|
Toolbox images with the steps described below.
|
||||||
cannot merge images from both Docker and Toolbox: any existing Docker image is
|
|
||||||
*replaced* by the Toolbox images.)
|
|
||||||
|
|
||||||
Run the following shell commands in a terminal. You need a working
|
In a terminal, while running Toolbox, use `docker commit` to create an image snapshot
|
||||||
`qemu-img`; it is part of the qemu package in both MacPorts and Brew:
|
from a container, for each container you wish to preserve:
|
||||||
|
|
||||||
```sh
|
```
|
||||||
$ brew install qemu # or sudo port install qemu
|
$ docker commit nginx
|
||||||
|
sha256:1bc0ee792d144f0f9a1b926b862dc88b0206364b0931be700a313111025df022
|
||||||
```
|
```
|
||||||
|
|
||||||
First, find your Toolbox disk images. You probably have just one:
|
Next, export each of these images (and any other images you wish to keep):
|
||||||
`~/.docker/machine/machines/default/disk.vmdk`.
|
|
||||||
|
|
||||||
```sh
|
```
|
||||||
$ vmdk=~/.docker/machine/machines/default/disk.vmdk
|
$ docker save -o nginx.tar sha256:1bc0ee792d144f0f9a1b926b862dc88b0206364b0931be700a313111025df022
|
||||||
$ file "$vmdk"
|
|
||||||
/Users/akim/.docker/machine/machines/default/disk.vmdk: VMware4 disk image
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Second, find out the location and format of the disk image used by your Docker
|
Next, when running Docker Desktop on Mac, reload all these images:
|
||||||
Desktop.
|
|
||||||
|
|
||||||
```sh
|
```
|
||||||
$ settings=~/Library/Group\ Containers/group.com.docker/settings.json
|
$ docker load -i nginx.tar
|
||||||
$ dimg=$(sed -En 's/.*diskPath.*:.*"(.*)".*/\1/p' < "$settings")
|
Loaded image ID: sha256:1bc0ee792d144f0f9a1b926b862dc88b0206364b0931be700a313111025df022
|
||||||
$ echo "$dimg"
|
|
||||||
/Users/akim/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw
|
|
||||||
```
|
```
|
||||||
|
|
||||||
In this case the format is `raw` (it could have been `qcow2`), and the location
|
Note these steps will not migrate any `docker volume` contents: these must
|
||||||
is `~/Library/Containers/com.docker.docker/Data/vms/0/`.
|
be copied across manually.
|
||||||
|
|
||||||
Then:
|
|
||||||
- if your format is qcow2, run
|
|
||||||
```sh
|
|
||||||
$ qemu-img convert -p -f vmdk -O qcow2 -o lazy_refcounts=on "$vmdk" "$dimg"
|
|
||||||
```
|
|
||||||
- if your format is raw, run the following command. If you are short on disk
|
|
||||||
space, it is likely to fail.
|
|
||||||
```sh
|
|
||||||
$ qemu-img convert -p -f vmdk -O raw "$vmdk" "$dimg"
|
|
||||||
```
|
|
||||||
|
|
||||||
Finally (optional), if you are done with Docker Toolbox, you may fully
|
Finally (optional), if you are done with Docker Toolbox, you may fully
|
||||||
[uninstall
|
[uninstall
|
||||||
|
|
|
@ -9,29 +9,33 @@ you have them, to Docker Desktop for Windows.
|
||||||
|
|
||||||
## How to migrate Docker Toolbox disk images to Docker Desktop
|
## How to migrate Docker Toolbox disk images to Docker Desktop
|
||||||
|
|
||||||
> **Warning**
|
Docker Desktop does not propose Toolbox image migration as part of its
|
||||||
>
|
installer since version 18.01.0. You can migrate existing Docker
|
||||||
> Migrating disk images from Docker Toolbox _clobbers_ Docker images if they
|
Toolbox images with the steps described below.
|
||||||
> exist. The migration process replaces the entire VM with your previous Docker
|
|
||||||
> Toolbox data.
|
|
||||||
{: .warning }
|
|
||||||
|
|
||||||
1. Install [qemu](https://www.qemu.org/){: target="_blank" class="_"} (a machine emulator): [https://cloudbase.it/downloads/qemu-img-win-x64-2_3_0.zip](https://cloudbase.it/downloads/qemu-img-win-x64-2_3_0.zip).
|
In a terminal, while running Toolbox, use `docker commit` to create an image snapshot
|
||||||
2. Install [Docker Desktop for Windows](install.md){: target="_blank" class="_"}.
|
from a container, for each container you wish to preserve:
|
||||||
3. Stop Docker Desktop, if running.
|
|
||||||
4. Move your current Docker VM disk to a safe location:
|
|
||||||
|
|
||||||
```shell
|
```
|
||||||
mv 'C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx' C:/<any directory>
|
> docker commit nginx
|
||||||
```
|
sha256:1bc0ee792d144f0f9a1b926b862dc88b0206364b0931be700a313111025df022
|
||||||
|
```
|
||||||
|
|
||||||
5. Convert your Toolbox disk image:
|
Next, export each of these images (and any other images you wish to keep):
|
||||||
|
|
||||||
```shell
|
```
|
||||||
qemu-img.exe convert 'C:\Users\<username>\.docker\machine\machines\default\disk.vmdk' -O vhdx -o subformat=dynamic -p 'C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx'
|
> docker save -o nginx.tar sha256:1bc0ee792d144f0f9a1b926b862dc88b0206364b0931be700a313111025df022
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Restart Docker Desktop (with your converted disk).
|
Next, when running Docker Desktop on Windows, reload all these images:
|
||||||
|
|
||||||
|
```
|
||||||
|
> docker load -i nginx.tar
|
||||||
|
Loaded image ID: sha256:1bc0ee792d144f0f9a1b926b862dc88b0206364b0931be700a313111025df022
|
||||||
|
```
|
||||||
|
|
||||||
|
Note these steps will not migrate any `docker volume` contents: these must
|
||||||
|
be copied across manually.
|
||||||
|
|
||||||
## How to uninstall Docker Toolbox
|
## How to uninstall Docker Toolbox
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue