Giter Site home page Giter Site logo

docker-sample's Introduction

An example Dockerfile for a Java webapp + a few dependencies:

  • JDK 8
  • Nginx
  • git 1.7
  • Maven 3.1.1

Prerequisites

I assume you have installed Docker and it is running.

See the Docker website for installation instructions.

Build

Steps to build a Docker image:

  1. Clone this repo

     git clone https://github.com/cb372/docker-sample.git
    
  2. Manually download JDK 8u20 (x64 rpm) from the Oracle site

  3. Copy the JDK rpm to the appropriate folder

     cd docker-sample
     mkdir jdk
     cp ~/Downloads/jdk-8u20-linux-x64.rpm jdk
    
  4. Build the image

     cd ..
     docker build -t="my-app" docker-sample
    

    This will take a few minutes.

  5. Run the image's default command, which should start everything up. The -p option forwards the container's port 80 to port 8000 on the host. (Note that the host will actually be a guest if you are using boot2docker, so you may need to re-forward the port in VirtualBox.)

     docker run -p="8000:80" my-app
    
  6. Once everything has started up, you should be able to access the webapp via http://localhost:8000/ on your host machine.

     open http://localhost:8000/
    

You can also login to the image and have a look around:

docker run -i -t my-app /bin/bash

docker-sample's People

Contributors

cb372 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.