plugins {
id 'com.avast.gradle.docker-compose' version '0.17.6'
}
dockerCompose.isRequiredBy(test)
dockerCompose {
startedServices = ['db']
}
With a compose file with mariadb
version: '3.3'
services:
db:
platform: linux/x86_64
image: mariadb:10.5.8
profiles: ["all", "dev"]
container_name: footest-service-database-os
restart: always
environment:
MYSQL_DATABASE: 'fooStuff_db'
# So you don't have to use root, but you can if you like
MYSQL_USER: 'user'
# You can use whatever password you like
MYSQL_PASSWORD: 'password'
# Password for root access
MYSQL_ROOT_PASSWORD: 'password'
ports:
# This maps your mysql instance to port 3306 on your local machine.
# You may need to change this if you have the port in use.
# <Port exposed> : <MySQL Port running inside container>
- '3306:3306'
expose:
# Opens port 3306 on the container
- '3306'
# Where our data will be persisted
volumes:
- my-db:/var/lib/mysql
# Names our volume
volumes:
my-db:
The containers are deleted, however, the volume is not.
Using this with mysql/maria:
With a compose file with mariadb
The containers are deleted, however, the volume is not.
This may be the same issue as #369