问题
I am using docker-machine on OS:X. I would like to install Docker 1.11.2 into my boot2docker machine, however it looks like the combination of docker-machine and boot2docker are always pulling the latest release of boot2docker.
I have tried replacing ~/.docker/machine/machines/default/boot2docker.iso
with a manually downloaded iso matching 1.11.2, however this doesn't seem to actually change the version of docker.
I do not see anything listed in docker-machine documentation which suggests it to be possible to specify which iso or version of docker to use when creating the virtualmachine. I am using VirtualBox as driver.
How can I either downgrade the version of docker installed in my virtual machine or create a new one with a specific version installed?
回答1:
When creating a new machine it is possible to specify where to get the boot2docker ISO from using the --virtualbox-boot2docker-url
option. When doing that it will refrain from upgrading the machine to the latest version.
Example:
docker-machine create \
--driver virtualbox \
--virtualbox-memory 6144 \
--virtualbox-hostonly-cidr "10.10.10.1/24" \
--virtualbox-cpu-count "2" \
--virtualbox-disk-size "20000" \
--virtualbox-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v1.12.2/boot2docker.iso \
default
回答2:
It looks like there are two steps that need to happen to fully downgrade docker-machine.
First, download and replacing the boot2docker.iso
file located at ~/.docker/machine/cache/boot2docker.iso
. When you create a new docker-machine, it defaults to using the cached iso. Manually replacing it with whatever version iso you want is required.
This will then cause docker-machine to create the VM with the appropriate version of docker.
However, you also need to download a new version of docker toolbox in order to have the previous version for the client, as well. I am not sure how to navigate to older versions than the linked (1.11.2) but you can change the download url to whatever version you want and it seems some of them are still hosted.
回答3:
Run the following following steps:
Check your docker version:
$ docker -v Docker version 18.03.0-ce, build 0520e24
Download your docker version's of
boot2docker
(18.03.0-ce) from here into your local:wget https://github.com/boot2docker/boot2docker/releases/download/v18.03.0-ce/boot2docker.iso -P ~/.docker/machine/cache/test/boot2docker-v18-03-0-ce.iso
Create the
new_virtual_box_name
using the downloaded version ofboot2docker
:docker-machine create --driver virtualbox --virtualbox-boot2docker-url ~/.docker/machine/cache/test/boot2docker-v18-03-0-ce.iso new_virtual_box_name
来源:https://stackoverflow.com/questions/38212044/how-to-downgrade-version-of-docker-used-by-docker-machine-and-boot2docker