ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Running Java Applications with Docker

Автор: SwitchIT

Загружено: 2024-03-06

Просмотров: 172

Описание: This video explains steps to run a simple Java application that prints "Hello, World!" with docker or in other words steps to containerize your Java application.
1. Create a Java file named HelloWorld.java with the following content
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}

2. Compile the Java application (make sure Java is installed and available in PATH). Open terminal and run following command:

javac HelloWorld.java

3. Create a file named Dockerfile (without any file extension) in the same directory as HelloWorld.java. Add the following content to the Dockerfile:

FROM openjdk:latest
WORKDIR /app
COPY HelloWorld.class /app
CMD ["java", "HelloWorld"]

This Dockerfile instructs Docker to use the latest version of the OpenJDK image, set the working directory to /app, copy the compiled HelloWorld.class file into the /app directory inside the container, and run the java HelloWorld command when the container starts.

4. Build the Docker image:
Open your terminal or command prompt, navigate to the directory containing HelloWorld.java and Dockerfile, and run the following command to build the Docker image:

docker build -t hello-world-java .
This command builds a Docker image with the tag hello-world-java based on the Dockerfile in the current directory (.).

5. Run the Docker container:
Once the Docker image is built, you can run a container based on that image using the following command:

docker run hello-world-java

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Running Java Applications with Docker

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Docker для Начинающих за 49 Мин | Docker с Нуля | 2025 Переиздание

Docker для Начинающих за 49 Мин | Docker с Нуля | 2025 Переиздание

Игра, опередившая время на десятилетия  | The Movies 2005

Игра, опередившая время на десятилетия | The Movies 2005

Похудей на 45 КГ, Выиграй $250,000!

Похудей на 45 КГ, Выиграй $250,000!

GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker

GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker

Установка N8N на ЛЮБОЙ сервер. Docker. Portainer. Nginx Proxy Manager

Установка N8N на ЛЮБОЙ сервер. Docker. Portainer. Nginx Proxy Manager

Купили УРАЛ Лесовоз. Первое знакомство!

Купили УРАЛ Лесовоз. Первое знакомство!

ВСЕ ЧТО НУЖНО ЗНАТЬ О ДЕПЛОЕ, DOCKER, CI/CD, ЕСЛИ ТЫ НОВИЧОК

ВСЕ ЧТО НУЖНО ЗНАТЬ О ДЕПЛОЕ, DOCKER, CI/CD, ЕСЛИ ТЫ НОВИЧОК

Docker Для Начинающих за 1 Час | Docker с Нуля

Docker Для Начинающих за 1 Час | Docker с Нуля

Ultimate Docker Compose Tutorial

Ultimate Docker Compose Tutorial

БЕЛКОВСКИЙ:

БЕЛКОВСКИЙ: "Это еще не конец!": как с Ираном, что с дочерьми Путина, чем болен Кадыров, Украина

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]