Dgraph: docker run didn't work

Created on 17 Aug 2017  Â·  8Comments  Â·  Source: dgraph-io/dgraph

My env info
â–¶ docker --version
Docker version 17.06.0-ce, build 02c1d87

â–¶ docker-machine --version
docker-machine version 0.12.0, build 45c69ad

Error

â–¶ docker run -it -p 8080:8080 -p 9080:9080 -v ~/dgraph:/dgraph --name dgraph dgraph/dgraph dgraph --bindall=true --memory_mb 2048

Dgraph version   : v0.8.1
Commit SHA-1     : d86498f7
Commit timestamp : 2017-08-16 12:53:17 +1000
Branch           : HEAD

2017/08/17 21:38:02 Error while creating badger KV WAL store error: sync w: invalid argument
Directory entry for compaction log
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.newLevelsController
    /home/travis/gopath/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/levels.go:147
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.NewKV
    /home/travis/gopath/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/kv.go:223
github.com/dgraph-io/dgraph/dgraph.(*ServerState).initStorage
    /home/travis/gopath/src/github.com/dgraph-io/dgraph/dgraph/server.go:69
github.com/dgraph-io/dgraph/dgraph.NewServerState
    /home/travis/gopath/src/github.com/dgraph-io/dgraph/dgraph/server.go:54
main.main
    /home/travis/gopath/src/github.com/dgraph-io/dgraph/cmd/dgraph/main.go:702
runtime.main
    /home/travis/.gimme/versions/go1.8.linux.amd64/src/runtime/proc.go:185
runtime.goexit
    /home/travis/.gimme/versions/go1.8.linux.amd64/src/runtime/asm_amd64.s:2197
investigate

All 8 comments

Hi @candysmurf

What operating system are you on? Are you on Windows?

@pawanrawal, I'm using MacOS Sierra. Version 10.12.6. Thanks for your quick response.

I have seen a similar issue on Windows but seems like the issue is not OS specific and is related to Docker (though I can't reproduce it on MacOS Yosemite). I am investigating this. In the mean time, you could install the binaries directly to try out Dgraph.
https://docs.dgraph.io/get-started/#from-install-scripts

@pawanrawal, thanks for your quick help. Yes, I'm trying it out.

@candysmurf Does the binary work for you?

Also it should work if directory is not mounted.

docker run -it -p 8080:8080 -p 9080:9080 --name dgraph dgraph/dgraph dgraph --bindall=true --memory_mb 2048

@candysmurf
It's slow if we use a shared directory between host and container. The recommended way is to use docker data volumes. I have updated the docs for the same.
https://docs.dgraph.io/master/get-started/#on-non-linux-distributions.

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

You shouldn't get the error if you are using data volumes.

Closing this for now. Let us know if there's more we can do here.

I had the same error with docker-compose (version 1.17.1) on Windows 10. Using volumes resolved this. Here is the Compose configuration that worked for me:

version: "3.2"
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - type: volume
        source: dgraphvolume
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --port_offset -2000 --my=zero:5080
  server:
    image: dgraph/dgraph:latest
    volumes:
      - type: volume
        source: dgraphvolume
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph server --my=server:7080 --memory_mb=2048 --zero=zero:5080
  ratel:
    image: dgraph/dgraph:latest
    volumes:
      - type: volume
        source: dgraphvolume
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 8081:8081
    command: dgraph-ratel

volumes:
  dgraphvolume:
Was this page helpful?
0 / 5 - 0 ratings

Related issues

pepoospina picture pepoospina  Â·  3Comments

fritzblue picture fritzblue  Â·  5Comments

yupengfei picture yupengfei  Â·  4Comments

armaneous picture armaneous  Â·  3Comments

captain-me0w picture captain-me0w  Â·  4Comments