Running 2 services

I’m building an image for github’s Linkurious project, based on an image already in the hub for the neo4j database. the neo image automatically runs the server on port 7474 and my image runs on port 8000.

when I run my image I publish both ports (could I do this with EXPOSE?):

  • Docker networking revers proxy without docker-compose
  • Cannot start simple docker container with “docker start” command from created image
  • ubuntu 14.04 SuperDesk Raven not configured (logging is disabled)
  • Deploying docker-compose containers
  • how to set docker container hostname/IP permanently
  • Integrating Docker with jenkins for continuous integration
  • docker run -d --publish=7474:7474 --publish=8000:8000 linkurious

    but only my server seems to run. if I hit http://[ip]:7474/ I get nothing. is there something special I have to do to make sure they both run?

    * Edit I *

    here’s my Dockerfile:

    FROM neo4j/neo4j:latest
    RUN apt-get -y update
    RUN apt-get install -y git
    RUN apt-get install -y npm
    RUN apt-get install -y nodejs-legacy
    RUN git clone git://
    RUN cd linkurious.js && npm install && npm run build
    CMD cd linkurious.js && npm start

    * Edit II *

    to perhaps help explain my quandary, I’ve asked a different question

  • docker container size much greater than actual size
  • In dockerfile after create or copy file or directory in RUN statement it not/doesn't exists
  • What is the optimal way to run a Node API in Docker on Amazon ECS?
  • How to monitor Nodejs app running on Kubernetes
  • Which way to run PostgeSQL in Docker?
  • Why isn't my postgres docker container mounting the database?
  • One Solution collect form web for “Running 2 services”

    EXPOSE is there to allow inter-containers communication (within the same docker daemon), with the docker run --link option.
    Port mapping is there to map EXPOSEd ports to the host, to allow client-to-container communication. So you need --publish.

    See also “Difference between “expose” and “publish” in docker”.

    See also an example with “Advanced Usecase with Docker: Connecting Containers”

    Make sure though that the ip is the right one ($(docker-machine ip default)).

    If you are using a VM (meaning, you are not using docker directly on a Linux host, but on a Linux VM with VirtualBox), make sure the mapped ports 7474 and 8000 are port forwarded from the host to the VM.

    VBoxManage controlvm boot2docker-vm natpf1 "name,tcp,,7474,,7474"
    VBoxManage controlvm boot2docker-vm natpf1 "name,tcp,,8000,,8000"

    In the OP’s case, this is using neo4j: see “Neo4j with Docker”, based on the neo4j/neo4j/ image and its Dockerfile:

    ENTRYPOINT ["/"] 
    CMD ["neo4j"]

    It is not meant to be used for installing another service (like nodejs), where the CMD cd linkurious.js && npm start would completely override the neo4j base image CMD (meaning neo4j would never start).

    It is meant to be run on its own:

    # interactive with terminal
    docker run -i -t --rm --name neo4j -v $HOME/neo4j-data:/data -p 8474:7474 neo4j/neo4j
    # as daemon running in the background
    docker run -d --name neo4j -v $HOME/neo4j-data:/data -p 8474:7474 neo4j/neo4j

    And then used by another image, with a --link neo4j:neo4j directive.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.