HomeBulid 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

Onurdesk is a technical platform based primarily on Spring, Java, and Nodejs ecosystem app creation. We write tutorials and manuals concentrating extensively on realistic and real-life usage cases.


Please enter your comment!
Please enter your name here

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

Most Popular

Recent Comments