Coder Social home page Coder Social logo

docker-compose-example's Introduction

Простой пример Docker Compose с PostgreSql + Spring Boot (+ pgAdmin4 в качестве бонуса)

Docker-desktop;
Java 11;
PostgreSql 12;
pgAdmin4;

Spring-приложение очень простое- контроллер для обработки GET и POST запросов, репозиторий для работы с БД и модель.
Для запуска в консоли перейти в директорию с файлом docker-compose.yml и выполнить docker-compose up

pgAdmin4 доступен по http://localhost
(ip для подключения к серверу БД можно глянуть с помощью ip a в консоли.)

Для работы с БД:
psql -h localhost -U postgres -d postgres
или
docker exec -it docker_db psql -U postgres

Для запросов к spring-приложению можно использовать Postman
или прописать в консоли:
curl -d '{"name":"value1", "description":"value2"}' -H "Content-Type: application/json" -X POST http://localhost:8090/post
curl -X GET http://localhost:8090/post

Удаление в Docker:
всех контейнеров:
docker rm $(docker ps -a -q)
образов:
docker rmi %id образа%

docker-compose-example's People

Contributors

romanmorozov88 avatar

Watchers

 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.