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?):

  • Static Go Binaries w/ Docker - Entrypoint Not Found
  • Image deployment with config files
  • Does OpenShift support true multi-tenancy by segregating containers on host-level?
  • How do I set VirtualBox VM options using docker-machine?
  • “500 Internal Server Error” when pushing docker images using gcloud and a service account with “Owner” permission
  • Elastic Beanstalk with multiple environments and URL routing between them
  • 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

  • How to push/build a docker image in release process via sbt-release
  • How to run local server in host?
  • I keep getting a 404 error when trying to push to my private repository. Why?
  • Can several nodes access mounted docker containers
  • Statically linked Haskell program in Docker
  • docker private image can not be pulled in centos7
  • 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.