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
|
||||
installer since version 18.01.0. You can migrate existing Docker
|
||||
Toolbox images with the scripts described below. (This migration
|
||||
cannot merge images from both Docker and Toolbox: any existing Docker image is
|
||||
*replaced* by the Toolbox images.)
|
||||
Toolbox images with the steps described below.
|
||||
|
||||
Run the following shell commands in a terminal. You need a working
|
||||
`qemu-img`; it is part of the qemu package in both MacPorts and Brew:
|
||||
In a terminal, while running Toolbox, use `docker commit` to create an image snapshot
|
||||
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:
|
||||
`~/.docker/machine/machines/default/disk.vmdk`.
|
||||
Next, export each of these images (and any other images you wish to keep):
|
||||
|
||||
```sh
|
||||
$ vmdk=~/.docker/machine/machines/default/disk.vmdk
|
||||
$ file "$vmdk"
|
||||
/Users/akim/.docker/machine/machines/default/disk.vmdk: VMware4 disk image
|
||||
```
|
||||
$ docker save -o nginx.tar sha256:1bc0ee792d144f0f9a1b926b862dc88b0206364b0931be700a313111025df022
|
||||
```
|
||||
|
||||
Second, find out the location and format of the disk image used by your Docker
|
||||
Desktop.
|
||||
Next, when running Docker Desktop on Mac, reload all these images:
|
||||
|
||||
```sh
|
||||
$ settings=~/Library/Group\ Containers/group.com.docker/settings.json
|
||||
$ dimg=$(sed -En 's/.*diskPath.*:.*"(.*)".*/\1/p' < "$settings")
|
||||
$ echo "$dimg"
|
||||
/Users/akim/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw
|
||||
```
|
||||
$ docker load -i nginx.tar
|
||||
Loaded image ID: sha256:1bc0ee792d144f0f9a1b926b862dc88b0206364b0931be700a313111025df022
|
||||
```
|
||||
|
||||
In this case the format is `raw` (it could have been `qcow2`), and the location
|
||||
is `~/Library/Containers/com.docker.docker/Data/vms/0/`.
|
||||
|
||||
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"
|
||||
```
|
||||
Note these steps will not migrate any `docker volume` contents: these must
|
||||
be copied across manually.
|
||||
|
||||
Finally (optional), if you are done with Docker Toolbox, you may fully
|
||||
[uninstall
|
||||
|
|
|
@ -9,29 +9,33 @@ you have them, to Docker Desktop for Windows.
|
|||
|
||||
## How to migrate Docker Toolbox disk images to Docker Desktop
|
||||
|
||||
> **Warning**
|
||||
>
|
||||
> Migrating disk images from Docker Toolbox _clobbers_ Docker images if they
|
||||
> exist. The migration process replaces the entire VM with your previous Docker
|
||||
> Toolbox data.
|
||||
{: .warning }
|
||||
Docker Desktop does not propose Toolbox image migration as part of its
|
||||
installer since version 18.01.0. You can migrate existing Docker
|
||||
Toolbox images with the steps described below.
|
||||
|
||||
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).
|
||||
2. Install [Docker Desktop for Windows](install.md){: target="_blank" class="_"}.
|
||||
3. Stop Docker Desktop, if running.
|
||||
4. Move your current Docker VM disk to a safe location:
|
||||
In a terminal, while running Toolbox, use `docker commit` to create an image snapshot
|
||||
from a container, for each container you wish to preserve:
|
||||
|
||||
```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
|
||||
|
||||
|
|
Loading…
Reference in New Issue