# Create a docker image from source

**URL:** <https://discuss.dgraph.io/t/create-a-docker-image-from-source/1881>\
**Category:** Users\
**Created:** [October 23, 2017, 1:16am UTC](https://discuss.dgraph.io/t/create-a-docker-image-from-source/1881 "2017-10-23T01:16:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jzhu077](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@jzhu077](https://discuss.dgraph.io/u/jzhu077)\
**Post date:** [October 23, 2017, 1:16am UTC](https://discuss.dgraph.io/t/create-a-docker-image-from-source/1881/1 "2017-10-23T01:16:04Z")

</div>

Steps I took:

1. pull master branch
2. reset to ca68a34d39afce6ffaf47befefccc0bc3e044c06 which is v0.8.3
3. build all binary with `go install github.com/dgraph-io/dgraph/cmd/...`
4. then use dgraph/dgraph:master as base image and replace all binaries ( dgraph dgraph-bulk-loader dgraph-converter dgraph-live-loader dgraphzero postingiterator)
5. test run locally. mkdir -p ~/dgraph  
docker run -it -p 8080:8080 -p 9080:9080 -v ~/dgraph:/dgraph --name dgraph new-dgraph:latest dgraphzero -w zw  
docker exec -it dgraph dgraph --bindall=true --memory\_mb 2048 -peer 127.0.0.1:8888

### It does not seem to work because I cannot access Dgraph UI via localhost:8080

### logs from dgraph zero:

Setting up listener at: localhost:8888  
Setting up listener at: localhost:8889  
2017/10/23 00:59:46 node.go:246: Group 0 found 0 entries  
2017/10/23 00:59:46 raft.go:567: INFO: 1 became follower at term 0  
2017/10/23 00:59:46 raft.go:316: INFO: newRaft 1 [peers: , term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]  
2017/10/23 00:59:46 raft.go:567: INFO: 1 became follower at term 1  
Running Dgraph zero…  
2017/10/23 00:59:49 raft.go:749: INFO: 1 is starting a new election at term 1  
2017/10/23 00:59:49 raft.go:580: INFO: 1 became candidate at term 2  
2017/10/23 00:59:49 raft.go:664: INFO: 1 received MsgVoteResp from 1 at term 2  
2017/10/23 00:59:49 raft.go:621: INFO: 1 became leader at term 2  
2017/10/23 00:59:49 node.go:301: INFO: raft.node: 1 elected leader 1 at term 2  
2017/10/23 01:00:06 zero.go:239: Got connection request: id:1 addr:“localhost:12345”  
2017/10/23 01:00:06 pool.go:104: == CONNECT ==\> Setting localhost:12345  
2017/10/23 01:00:06 raft.go:253: Applied proposal: {Id:3127895948 Member:id:1 group\_id:1 addr:“localhost:12345” Tablet: MaxLeaseId:0}  
2017/10/23 01:00:06 raft.go:253: Applied proposal: {Id:683498661 Member:id:1 group\_id:1 addr:“localhost:12345” leader:true last\_update:1508720406 Tablet: MaxLeaseId:0}

### logs from dgraph

2017/10/23 02:29:05 pool.go:104: == CONNECT ==\> Setting 127.0.0.1:8888  
2017/10/23 02:29:05 gRPC server started. Listening on port 9080  
2017/10/23 02:29:05 HTTP server started. Listening on port 8080  
2017/10/23 02:29:05 worker.go:105: Worker listening at address: [::]:12345  
2017/10/23 02:29:05 groups.go:114: Connected to group zero. State: counter:5 groups:\<key:1 value:\<members:\<key:1 value:\<id:1 group\_id:1 addr:“localhost:12345” \> \> \> \> zeros:\<key:1 value:\<id:1 addr:“localhost:8888” leader:true \> \>  
2017/10/23 02:29:05 draft.go:143: Node ID: 1 with GroupID: 1  
2017/10/23 02:29:05 pool.go:104: == CONNECT ==\> Setting localhost:8888  
2017/10/23 02:29:05 node.go:246: Group 1 found 0 entries  
2017/10/23 02:29:05 draft.go:702: New Node for group: 1  
2017/10/23 02:29:05 raft.go:567: INFO: 1 became follower at term 0  
2017/10/23 02:29:05 raft.go:316: INFO: newRaft 1 [peers: , term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]  
2017/10/23 02:29:05 raft.go:567: INFO: 1 became follower at term 1  
2017/10/23 02:29:05 raft.go:749: INFO: 1 is starting a new election at term 1  
2017/10/23 02:29:05 raft.go:580: INFO: 1 became candidate at term 2  
2017/10/23 02:29:05 raft.go:664: INFO: 1 received MsgVoteResp from 1 at term 2  
2017/10/23 02:29:05 raft.go:621: INFO: 1 became leader at term 2  
2017/10/23 02:29:05 node.go:301: INFO: raft.node: 1 elected leader 1 at term 2

### update: Build with following Dockerfile failes to access UI as well

#FROM dgraph/dgraph:master  
FROM ubuntu:14.04  
MAINTAINER Dgraph Labs [contact@dgraph.io](mailto:contact@dgraph.io)

RUN apt-get update

RUN apt-get -y --force-yes install wget curl tar  
RUN apt-get install -y --force-yes software-properties-common python-software-properties && sudo add-apt-repository ppa:ubuntu-toolchain-r/test  
RUN apt-get update  
RUN apt-get install -y --force-yes g+±4.9

COPY bin/dgraph /usr/local/bin/dgraph  
COPY bin/dgraphzero /usr/local/bin/dgraphzero  
COPY bin/dgraph-bulk-loader /usr/local/bin/dgraph-bulk-loader  
COPY bin/dgraph-converter /usr/local/bin/dgraph-converter  
COPY bin/dgraph-live-loader /usr/local/bin/dgraph-live-loader  
COPY bin/postingiterator /usr/local/bin/postingiterator

RUN mkdir /dgraph

EXPOSE 8080  
EXPOSE 9080  
WORKDIR /dgraph

CMD [“dgraph”]

---

<div class="post-metadata">

**Author:** ![peter](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/peter/32/574_2.png) [@peter](https://discuss.dgraph.io/u/peter)\
**Post date:** [October 23, 2017, 2:54am UTC](https://discuss.dgraph.io/t/create-a-docker-image-from-source/1881/2 "2017-10-23T02:54:57Z")

</div>

Looks like a port issue to me. Try exposing 8888 as well.

May I ask why are you wanting to install from source? (I’m curious).

---

<div class="post-metadata">

**Author:** ![jzhu077](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@jzhu077](https://discuss.dgraph.io/u/jzhu077)\
**Post date:** [October 23, 2017, 3:33am UTC](https://discuss.dgraph.io/t/create-a-docker-image-from-source/1881/3 "2017-10-23T03:33:53Z")

</div>

I will try that. I try to build from source to extend the timeout at [https://github.com/dgraph-io/dgraph/blob/master/dgraph/server.go#L231](https://github.com/dgraph-io/dgraph/blob/master/dgraph/server.go#L231) as some of our queries are taking longer than 1 min to get result

---

<div class="post-metadata">

**Author:** ![peter](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/peter/32/574_2.png) [@peter](https://discuss.dgraph.io/u/peter)\
**Post date:** [October 23, 2017, 5:25am UTC](https://discuss.dgraph.io/t/create-a-docker-image-from-source/1881/4 "2017-10-23T05:25:44Z")

</div>

It’s strange that queries would take that long, they must be visiting a large number of nodes?

If you really have a need to run queries that take more than 60s, you could raise a ticket on github and we can consider making it configurable.

---

<div class="post-metadata">

**Author:** ![jzhu077](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@jzhu077](https://discuss.dgraph.io/u/jzhu077)\
**Post date:** [October 23, 2017, 6:49am UTC](https://discuss.dgraph.io/t/create-a-docker-image-from-source/1881/5 "2017-10-23T06:49:13Z")

</div>

Yes there are more than 110K of nodes. For sure that will be much nicer if the time out is configuable.  
BTW I figured out the I actually missing dashboard asset. So the solution will be

1. cd into `dashboad` then run `npm install` and `npm run build`
2. copy everything in the build folder in to the docker image
3. use flag `-ui /build` when running `dgraph` command.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [November 22, 2017, 6:49am UTC](https://discuss.dgraph.io/t/create-a-docker-image-from-source/1881/6 "2017-11-22T06:49:22Z")

</div>

Closed on November 22, 2017, 6:49am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
