Skip to content

C: Docker Deployment

dcox-nmdp edited this page Jun 1, 2017 · 2 revisions

Building this Service with Docker

This page walks you through how to build the epitope-service image and how to run the service in its own container with Docker.

What is Docker?

Building Docker Image

Use your CLI to maneuver to the directory which contains the service's pom.xml file service-epitope/dropwizard. Once there, run the command mvn clean package. This will create a new directory target. Navigate to the docker directory nested inside target cd target/docker/. From there, run this docker build command to build your image.

# -t name_of_service:build_tag
# . location of Dockerfile
docker build -t epitope-service:0.0.2-SNAPSHOT .

You can check to make sure the image was successfully built by typing docker images and looking for an image labeled epitope-service.

Running the Service

# -d runs the service in the background
# --name name given to the executed container
# -p exposed ports, meaning service will be found at http://localhost:48080-48081
# epitope-service:0.0.2-SNAPSHOT name of the image you're executing
docker run -d --name epitope-service -p 48080-48081:48080-48081 epitope-service:0.0.2-SNAPSHOT

To check to see that the docker container was successfully executed type docker ps -a into your CLI and look for a new container labeled epitope-service. It may take a little while for the epitope-service to boot up. You can check to make sure it is working while you wait with the command docker logs -f [CONTAINER ID]. Once up and running you can access the epitope-service through your localhost on port 48080.

http://localhost:48080

Clone this wiki locally