cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Neo4j and Golang (using Docker)

Hi - I'm trying to create a docker image that will support Neo4j and Golang. Here is my Dockerfile
'''
FROM neo4j:latest
MAINTAINER dmazzoni davem@ltsnet.net

RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y build-essential

FROM golang:latest
RUN apt-get update
RUN apt-get -y install vim
RUN apt-get -y install wget
CMD wget golang.org/dl/go1.14.6.linux-amd64.tar.gz
CMD tar -C /usr/local -xf go1.14.6.linux-amd64.tar.gz
#docker build .
'''
I can start this and it looks good with go, but I don't know how to get neo4j 'working'.
My goal is to use neoj4 with go using a docker image.
Any suggestions? Am I starting it the wrong way (docker run -it golangneo4j /bin/bash)?
Thanks!

5 REPLIES 5

Disclaimer: Not an expert in Docker

You could just create a script file and put it into the image (or call the script directly in the build file):
There is for certain something to optimize in the waiting but since there is no netcat in the image you have to live with what is there

#!/bin/bash

neo4j-admin set-initial-password "secret"
neo4j start

until (exec 3<>/dev/tcp/127.0.0.1/7687) &>/dev/null; do
  echo "Try again"
  sleep 1s
done

<your execution>

If you do not want to execute anything, you could just ignore the waiting and all the stuff.

Thanks for the reply. Actually I got the neo4j example/docker to run. Can I extend it (another pull -- day Ubuntu or golang) and still run the same startup?

This is the moment my knowledge ends.

Thanks anyway.
Have a great weekend!

I have recently uploaded an example as a "proof of concept" using Golang, gqlgen and Docker; you can find it here.

Cheers