[ BAEL 5508 ] - Mounting Multiple Volumes on a Docker Container (#12589)

* multiple mounts docker compose

* exclude localstack files
This commit is contained in:
lucaCambi77 2022-08-16 03:09:12 +02:00 committed by GitHub
parent 8ce82953c5
commit c712729d6a
5 changed files with 58 additions and 1 deletions

5
.gitignore vendored
View File

@ -99,4 +99,7 @@ spring-boot-modules/spring-boot-react/frontend/yarn.lock
spring-boot-modules/spring-boot-properties-3/*.log
# SDKMan
.sdkmanrc
.sdkmanrc
# Localstack
**/.localstack

View File

@ -0,0 +1,15 @@
services:
mysql-db:
image: mysql:latest
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_ROOT_HOST=localhost
ports:
- '3306:3306'
volumes:
- first-volume-data:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
volumes:
first-volume-data:
external: true

View File

@ -0,0 +1,9 @@
CREATE DATABASE IF NOT EXISTS test;
use test;
CREATE TABLE IF NOT EXISTS test_table (id int, description varchar(255));
INSERT INTO test_table VALUES (1, 'TEST_1');
INSERT INTO test_table VALUES (2, 'TEST_2');
INSERT INTO test_table VALUES (3, 'TEST_3');

View File

@ -0,0 +1,15 @@
services:
localstack:
privileged: true
image: localstack/localstack:latest
container_name: localstack
ports:
- '4563-4599:4563-4599'
- '8055:8080'
environment:
- SERVICES=s3
- DEBUG=1
- DATA_DIR=/tmp/localstack/data
volumes:
- './.localstack:/var/lib/localstack'
- '/var/run/docker.sock:/var/run/docker.sock'

View File

@ -0,0 +1,15 @@
services:
my_app:
image: web-app:latest
container_name: web-app
ports:
- "8080:8080"
volumes:
- first-volume-data:/container-path-1
- second-volume-data:/container-path-2:ro
volumes:
first-volume-data:
driver: local
second-volume-data:
driver: local