Bulid ToolDockerLearn all about docker javafile

Learn all about docker javafile

Docker Java Application Example

  1. Create a folder

2. Create a Java File
class DockerTest{
public static void main(String[] args){
System.out.println("This is docker java ");
}
}

3. Create a DockerFile
FROM java:8
COPY . /var/www/java
WORKDIR /var/www/java
RUN javac DockerTest.java
CMD ["java", "DockerTest"]

4. Bulid a docker image by command
Usage : docker build -t java-app .

  1. 5. Run the docker image by command
    Usage : docker run java-app

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe Today

GET EXCLUSIVE FULL ACCESS TO PREMIUM CONTENT

Get unlimited access to our EXCLUSIVE Content and our archive of subscriber stories.

Exclusive content

Latest article

More article