boot2docker / boot2docker

DEPRECATED; see https://github.com/boot2docker/boot2docker/pull/1408
https://github.com/boot2docker/boot2docker/pull/1408
Apache License 2.0
8.33k stars 1.29k forks source link

LevelDB doesn't like vboxfs #794

Open olalonde opened 9 years ago

olalonde commented 9 years ago

I have a docker-compose.yml file that looks like this:

bitcoind:
  image: kylemanna/bitcoind
  volumes:
    - ~/.bitcoin:/bitcoin/.bitcoin
  user: root
  command: bitcoind -server=0 -testnet -printtoconsole
  ports:
    - "18333"

I'm getting the following error when running docker-compose up bitcoind:

$ docker-compose up bitcoind
Recreating bsync_bitcoind_1...
Attaching to bsync_bitcoind_1
bitcoind_1 | Bitcoin version v0.9.4.0-g41f94ed-beta (Mon, 12 Jan 2015 10:36:57 +0100)
bitcoind_1 | Using OpenSSL version OpenSSL 1.0.1f 6 Jan 2014
bitcoind_1 | Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
bitcoind_1 | Default data directory /bitcoin/.bitcoin
bitcoind_1 | Using data directory /bitcoin/.bitcoin/testnet3
bitcoind_1 | Using at most 125 connections (1048576 file descriptors available)
bitcoind_1 | Using 4 threads for script verification
bitcoind_1 | Using wallet wallet.dat
bitcoind_1 | init message: Verifying wallet...
bitcoind_1 | CDBEnv::Open : LogDir=/bitcoin/.bitcoin/testnet3/database ErrorFile=/bitcoin/.bitcoin/testnet3/db.log
bitcoind_1 | Bound to [::]:18333
bitcoind_1 | Bound to 0.0.0.0:18333
bitcoind_1 | init message: Loading block index...
bitcoind_1 | Opening LevelDB in /bitcoin/.bitcoin/testnet3/blocks/index
bitcoind_1 | IO error: /bitcoin/.bitcoin/testnet3/blocks/index: Invalid argument
bitcoind_1 | : Error opening block database.
bitcoind_1 |
bitcoind_1 | Do you want to rebuild the block database now?
bitcoind_1 | Aborted block database rebuild. Exiting.
bitcoind_1 | : Error opening block database.
bitcoind_1 |
bitcoind_1 | Do you want to rebuild the block database now?
bitcoind_1 | Shutdown : In progress...
bitcoind_1 | StopNode()
bitcoind_1 | Shutdown : done
bsync_bitcoind_1 exited with code 1

After some Googling, this is probably because LevelDB doesn't support the vboxfs filesystem which boot2docker uses for mounted directories.

I was wondering what are my options here (considering I want to persist the bitcoind data across docker-compose up commands). I tried mounting a directory directly from the boot2docker VM and it works fine but the VM quickly runs out of space (and resizing it is a PITA). Ideally, I would like to mount the ~/.bitcoind from my host but it won't work with vboxfs.

Is there a way to change which filesystem boot2docker uses for mounting?

olalonde commented 9 years ago

Well, I fixed the problem by mounting /Users with nfs instead of vboxsf in boot2docker. I made a script here: https://gist.github.com/olalonde/3f7512c0bd2bc8abb46d

SvenDowideit commented 9 years ago

@tianon @bfirsh another b2d user that created an nfs based solution....

olalonde commented 9 years ago

Disclaimer: I just tested the script on my local machine so I'm not sure it will work on different setups. Basically the script adds the correct line to /etc/exports on OS X and executes a shell script on b2d VM to mount /Users with nfs. It's safe to run the script multiple times because it deletes any line in /etc/exports that start with /Users (a backup of /etc/exports is made on first run).

hypergig commented 8 years ago

I just tried with docker for mac it works completely natively.

https://docs.docker.com/docker-for-mac/

I was able to use a blockchain that I copied from my bitcoind node that I was running in docker-machine.