Skip to content
This repository was archived by the owner on Sep 26, 2021. It is now read-only.
This repository was archived by the owner on Sep 26, 2021. It is now read-only.

Add "save" feature to permanent store data on VM #1718

Open
@emilianosantucci

Description

@emilianosantucci

Hi,
as boot2docker, I'm searching save option on docker-machine command to persist data on VM but I don't have found it.

It's in you roadmap?

Thanks in advantage
Emiliano

Activity

nathanleclaire

nathanleclaire commented on Aug 18, 2015

@nathanleclaire
Contributor

Hi @emilianosantucci ,

The boot2docker filesystem is intentionally read-only across reboots with the exception of containers, images, and configuration in /var/lib/boot2docker/profile. This promotes uniformity and the development of "pet" VMs.

What is the issue you are seeing?

ereslibre

ereslibre commented on Aug 18, 2015

@ereslibre

I think that what @emilianosantucci refers to is the lack of save command with docker-machine. Command that boot2docker had. This way the VM gets suspended to be restored afterwards.

It is useful in some situations. For example, when using https://github.com/brikis98/docker-osx-dev, rsync gets installed in the VM in order to sync your directories in a faster way than the vboxfs filesystem. If not saved, rsync needs to be reinstalled on every VM restart.

Thanks for this wonderful tool !

emilianosantucci

emilianosantucci commented on Aug 18, 2015

@emilianosantucci
Author

Thank you @nathanleclaire for your response.
Yes, @ereslibre it's right.

Prior on boot2docker we had the save command to save the changes on VM. It's useful also when it's impossible to persist data directly on local host.

For example, I'm creating a container for MongoDB instance and I need to store db's data. Due to incompatibility with VFS for MongoDB, it's impossibile to use a local path for persist data. An alternative approach, that I found, is to link a container with path on host to reach the goal.

Meanwhile on boot2docker it is possible, on docker-machine it's not.
I think that this feature is useful specially for OSX users like me ( and @ereslibre, sure :) ) or Win users, that need to use the VM to work with this great tool.

Thanks to all.

nathanleclaire

nathanleclaire commented on Aug 18, 2015

@nathanleclaire
Contributor

Very interesting. It certainly gets into a sticky discussion of whether or not we should support this feature, when I don't think it's possible to support across all of the drivers we have.

cc @ehazlett for input

bloo

bloo commented on Jan 6, 2016

@bloo

Definitely looking for this feature myself, using docker-machine managed VMs locally to simulate a live cluster and need to push some additional files that are then volume-mounted to my docker containers. +1

Jastrzebowski

Jastrzebowski commented on Jan 20, 2016

@Jastrzebowski

Still you can use Virtualbox GUI to save a VM, but it’s counterproductive as 💀… big +1 for this one

ebuildy

ebuildy commented on Jan 21, 2016

@ebuildy

A big +1, just lost all my prestashop data base ;-( after configuring all products, you really should put a big alert DIV saying "You will lost your data if you reboot the VM!" (at https://docs.docker.com/machine).

Any solution for now?

nathanleclaire

nathanleclaire commented on Jan 21, 2016

@nathanleclaire
Contributor

A big +1, just lost all my prestashop data base ;-( after configuring all products, you really should put a big alert DIV saying "You will lost your data if you reboot the VM!" (at https://docs.docker.com/machine).

If it's data in containers (including volumes, which is where data in Dockerland is usually intended to live), it should persist in the VM between boots.

mohdaliiqbal

mohdaliiqbal commented on Jan 22, 2016

@mohdaliiqbal

I'm hitting a bug (moby/moby#18180) where the work around is to upgrade/downgrade the docker version. I could change docker binary, but can't persist my changes across restarts of the VM. I was gonna do it as a quick workaround to this issue without having to change whole toolkit.

nathanleclaire

nathanleclaire commented on Jan 22, 2016

@nathanleclaire
Contributor

@mohdaliiqbal You should be able to change out the boot2docker.iso that the machine is using without losing your data.

All of the Docker data is mounted on a writeable, persistent volume in the VM.

You should be able to do something like (assuming your VM is default):

$ docker-machine stop default
$ wget https://github.com/tianon/boot2docker-legacy/releases/download/v1.10.0-rc1/boot2docker.iso -O ~/.docker/machine/machines/default/boot2docker.iso
$ docker-machine start default

And you will have Docker 1.10 RC / boot2docker.iso (with the AUFS fix) running in your VM with all containers etc. the same as they were before (be aware 1.10 has a content migration which may hang Docker for a bit though).

mohdaliiqbal

mohdaliiqbal commented on Jan 22, 2016

@mohdaliiqbal

@nathanleclaire thanks for the super fast response. That solved the problem.

nathanleclaire

nathanleclaire commented on Jan 22, 2016

@nathanleclaire
Contributor
Pmonnaie

Pmonnaie commented on Jan 28, 2016

@Pmonnaie

+1 on some kind of save
I'm on a setup where I need to connect to a local repository which is unsecured. I need to add an extra argument "insecure-registry" to the boot2docker profile each time I restart the VM. I figure this goes for ANY change to the boot2docker profile installation.

nathanleclaire

nathanleclaire commented on Jan 28, 2016

@nathanleclaire
Contributor

I'm on a setup where I need to connect to a local repository which is unsecured. I need to add an extra argument "insecure-registry" to the boot2docker profile each time I restart the VM. I figure this goes for ANY change to the boot2docker profile installation.

/var/lib/boot2docker/profile, which is where you should put such settings, will persist between reboots.

Pmonnaie

Pmonnaie commented on Jan 29, 2016

@Pmonnaie

@nathanleclaire Thanks for your quick reply. That is actually exactly what I'm doing. I'll give you some more details about my setup in case that helps you figure out what's going on. It's possible I'm just doing something really stupid, feel free to point it out. If you need more information, just let me know.

I only have the problem after starting the docker quickstart terminal when the VM is shutdown. If I restart the docker quickstart terminal without shutting down the VM the config is kept, otherwise it resets to the default. Unfortunately the VM shuts down when I shut down my computer.

I have docker-machine installed via docker toolbox on a windows 7 system. I edit the profile and restart the machine with the commands:

docker-machine ssh default
sudo vi /var/lib/boot2docker/profile
# here I adapt the config
exit
docker-machine restart default

After doing this everything works. However, after stopping the VM and then starting things again via the docker quickstart terminal ("C:\Program Files\Git\bin\bash.exe" --login -i "C:\Program Files\Docker Toolbox\start.sh"), I've lost all my config. Output from starting the quickstart terminal:

Machine default already exists in VirtualBox.
Starting machine default...
(default) Starting VM...
Machine "default" was started.
Started machines may have new IP addresses. You may need to re-run the `docker-m
achine env` command.
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): Regeneratin
g TLS certificates
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Setting environment variables for machine default...
nathanleclaire

nathanleclaire commented on Jan 30, 2016

@nathanleclaire
Contributor
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): Regeneratin
g TLS certificates

Hm, this shouldn't happen, and it's the reason why your config is re-setting.

nathanleclaire

nathanleclaire commented on Jan 30, 2016

@nathanleclaire
Contributor

Hm, https://github.com/docker/toolbox/blob/44307aea4ed2275c0d1054bda07a697e293ac89f/windows/start.sh#L37 should probably not be happening by default. Either that, or we need to reduce the scope of regenerate-certs (it resets all manual configuration as a side effect, because it was originally meant as much more of an "escape hatch" feature than to be a commonly used one).

soriyath

soriyath commented on Feb 1, 2016

@soriyath

I'd like it as well. I could synchronize system clock with this.

Pmonnaie

Pmonnaie commented on Feb 1, 2016

@Pmonnaie

@nathanleclaire
I tried to comment out the line yes | "${DOCKER_MACHINE}" regenerate-certs "${VM}" in the shell script (start.sh) as you indicated in your previous comment and that seems to fix the problem. So for now that works as a workaround for me. I'll let you know should I run into any other problems as a consequence of commenting that.
Thanks!

rgrebski

rgrebski commented on Jun 8, 2016

@rgrebski

II also had to comment out the line yes | "${DOCKER_MACHINE}" regenerate-certs "${VM}"
Certs were regenerated everytime I restarted my Windows host machine. Restarting "default" machine was not causing certificate re-generation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ereslibre@Pmonnaie@dgageot@bloo@Jastrzebowski

        Issue actions

          Add "save" feature to permanent store data on VM · Issue #1718 · docker/machine