Browser (Jetty) error when using neo4j:4.0.4 with docker-compose

Hello community. I'm struggling with this error. I'll share my config:
Windows 10 host
Docker 19, docker-compose 1.25.5

docker-compose.yml

version: "3"

services:
  app:
    hostname: app
    build: .
    expose:
      - 9000
    ports:
      - 9000:9000
    depends_on:
      - neo4j

  neo4j:
    hostname: neo4j
    image: neo4j:4.0.4
    environment:
      - NEO4J_AUTH=neo4j/Password
      - NEO4J_dbms_connector_http_advertised__address=app:7474
      - NEO4J_dbms_connector_bolt_advertised__address=neo4j:7687
    expose:
      - 7474
      - 7687
    ports:
      - 7474:7474
      - 7687:7687
    volumes:
      - ./neo4j/data:/data # Persisting data into host FS
      - ./neo4j/logs:/logs
      - ./neo4j/import:/var/lib/neo4j/import
      - ./neo4j/plugins:/plugins

running docker-compose up produces the following output:

neo4j_1  | Changed password for user 'neo4j'.
neo4j_1  | Directories in use:
neo4j_1  |   home:         /var/lib/neo4j
neo4j_1  |   config:       /var/lib/neo4j/conf
neo4j_1  |   logs:         /logs
neo4j_1  |   plugins:      /plugins
neo4j_1  |   import:       /var/lib/neo4j/import
neo4j_1  |   data:         /var/lib/neo4j/data
neo4j_1  |   certificates: /var/lib/neo4j/certificates
neo4j_1  |   run:          /var/lib/neo4j/run
neo4j_1  | Starting Neo4j.
neo4j_1  | 2020-06-04 04:10:06.550+0000 INFO  ======== Neo4j 4.0.4 ========
neo4j_1  | 2020-06-04 04:10:06.582+0000 INFO  Starting...
neo4j_1  | 2020-06-04 04:10:16.430+0000 INFO  Bolt enabled on 0.0.0.0:7687.
neo4j_1  | 2020-06-04 04:10:16.434+0000 INFO  Started.
neo4j_1  | 2020-06-04 04:10:19.414+0000 WARN  Failed startup of context o.e.j.w.WebAppContext@4aa517c3{/browser,jar:file:/var/lib/neo4j/lib/neo4j-browser-4.0.6.jar!/browser,UNAVAILABLE} Temp dir /tmp/jetty-0.0.0.0-7474-browser-_browser-any-1381892585880605109.dir not useable: writeable=false, dir=false
neo4j_1  | java.lang.IllegalStateException: Temp dir /tmp/jetty-0.0.0.0-7474-browser-_browser-any-1381892585880605109.dir not useable: writeable=false, dir=false
neo4j_1  |      at org.eclipse.jetty.webapp.WebInfConfiguration.configureTempDirectory(WebInfConfiguration.java:559)
neo4j_1  |      at org.eclipse.jetty.webapp.WebInfConfiguration.makeTempDirectory(WebInfConfiguration.java:531)
neo4j_1  |      at org.eclipse.jetty.webapp.WebInfConfiguration.resolveTempDirectory(WebInfConfiguration.java:479)
neo4j_1  |      at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:149)
neo4j_1  |      at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:506)
neo4j_1  |      at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:544)
neo4j_1  |      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
neo4j_1  |      at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
neo4j_1  |      at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119)
neo4j_1  |      at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
neo4j_1  |      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
neo4j_1  |      at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
neo4j_1  |      at org.eclipse.jetty.server.Server.start(Server.java:418)
neo4j_1  |      at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
neo4j_1  |      at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
neo4j_1  |      at org.eclipse.jetty.server.Server.doStart(Server.java:382)
neo4j_1  |      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
neo4j_1  |      at org.neo4j.server.web.Jetty9WebServer.startJetty(Jetty9WebServer.java:324)
neo4j_1  |      at org.neo4j.server.web.Jetty9WebServer.start(Jetty9WebServer.java:154)
neo4j_1  |      at org.neo4j.server.AbstractNeoServer.startWebServer(AbstractNeoServer.java:260)
neo4j_1  |      at org.neo4j.server.AbstractNeoServer$ServerComponentsLifecycleAdapter.start(AbstractNeoServer.java:473)
neo4j_1  |      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:444)
neo4j_1  |      at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
neo4j_1  |      at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:157)
neo4j_1  |      at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:114)
neo4j_1  |      at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:89)
neo4j_1  |      at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:35)
neo4j_1  | 2020-06-04 04:10:19.630+0000 INFO  Remote interface available at http://app:7474/

container doesn't stop, bolt keeps working, but going to browser interface produces the following output:

HTTP ERROR 503
Problem accessing /browser/. Reason:

    Service Unavailable

I also tried with docker run

docker run --name testneo4j --rm -p 7474:7474 -p 7687:7687 -it 
-v $HOME/neo4j/data:/data 
-v $HOME/neo4j/logs:/logs
-v $HOME/neo4j/import:/var/lib/neo4j/import
-v $HOME/neo4j/plugins:/plugins
--env NEO4J_AUTH=neo4j/test 
--env NEO4J_dbms_connector_http_advertised__address="localhost:7474" 
--env NEO4J_dbms_connector_bolt_advertised__address="localhost:7687" 
neo4j:4.0.4

produces the same outcome.
I must be missing something.

Thanks for your help :slight_smile:

I think you need to map user id (--user) and get rid of advertised settings:

docker run --rm \
--name neo4j \
-e NEO4J_AUTH=neo4j/123 \
-p 7474:7474 \
-p 7687:7687 \
-v $PWD/import:/var/lib/neo4j/import \
--user=$(id -u):$(id -g) \
neo4j:4.0.4
1 Like