Skip to content

Commit 9134019

Browse files
committed
Set default Docker image for Datasource Dev Services
1 parent 4a81941 commit 9134019

File tree

11 files changed

+46
-28
lines changed

11 files changed

+46
-28
lines changed

docs/src/main/asciidoc/_attributes.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
:mandrel-flavor: ${mandrel.image-tag-for-documentation}
1212
:surefire-version: ${version.surefire.plugin}
1313
:gradle-version: ${gradle-wrapper.version}
14+
:db2-image: ${db2.image}
15+
:mariadb-image: ${mariadb.image}
16+
:mssql-image: ${mssql.image}
17+
:oracle-image: ${oracle.image}
18+
:postgres-image: ${postgres.image}
1419
:elasticsearch-version: ${elasticsearch-server.version}
1520
:elasticsearch-image: ${elasticsearch.image}
1621
:opensearch-image: ${opensearch.image}

docs/src/main/asciidoc/databases-dev-services.adoc

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ By default, Quarkus uses the default image for the current version of Testcontai
5555
An example file is shown below:
5656

5757
.src/main/resources/container-license-acceptance.txt
58+
[source,subs=attributes+]
5859
----
59-
ibmcom/db2:11.5.0.0a
60-
mcr.microsoft.com/mssql/server:2022-latest
60+
{db2-image}
61+
{mssql-image}
6162
----
6263

6364
=== Capturing Logs
@@ -249,14 +250,14 @@ psql -h localhost -p <random port> -U quarkus
249250

250251
The random port can be found with `docker ps`
251252

252-
[source, bash]
253+
[source, bash, subs=attributes+]
253254
----
254255
docker ps
255256
256257
# returns something like this:
257258
258259
CONTAINER ID IMAGE [..] PORTS [..]
259-
b826e3a168c4 postgres:14.2 [..] 0.0.0.0:49174->5432/tcp, :::49174->5432/tcp [..] <1>
260+
b826e3a168c4 {postgres-image} [..] 0.0.0.0:49174->5432/tcp, :::49174->5432/tcp [..] <1>
260261
----
261262
<1> The random port is `49174`.
262263

@@ -283,10 +284,10 @@ docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Labels}}\t{{.Ports}}
283284
284285
An example output using Dev Services for PostgreSQL is the following:
285286
286-
[source, bash]
287+
[source, bash, subs=attributes+]
287288
----
288289
CONTAINER ID IMAGE LABELS PORTS
289-
a7034c91a392 postgres:14 org.testcontainers.sessionId=xyz,datasource=default,org.testcontainers=true 0.0.0.0:49154->5432/tcp, :::49154->5432/tcp
290+
a7034c91a392 {postgres-image} org.testcontainers.sessionId=xyz,datasource=default,org.testcontainers=true 0.0.0.0:49154->5432/tcp, :::49154->5432/tcp
290291
----
291292
292293
In the labels tab, we see that Quarkus added the datasource label, which can be very useful in differentiating containers when multiple
@@ -299,20 +300,20 @@ Dev Services have been started.
299300
The Database Dev Services supports xref:compose-dev-services.adoc[Compose Dev Services].
300301
It relies on a `compose-devservices.yml`, such as:
301302

302-
[source,yaml]
303+
[source,yaml,subs=attributes+]
303304
----
304305
name: <application name>
305306
services:
306307
postgresql:
307-
image: docker.io/postgres:17
308+
image: {postgres-image}
308309
ports:
309310
- "5432"
310311
environment:
311312
POSTGRES_USER: quarkus
312313
POSTGRES_PASSWORD: quarkus
313314
POSTGRES_DB: quarkus
314315
oracle:
315-
image: docker.io/gvenzl/oracle-free:23-slim-faststart
316+
image: {oracle-image}
316317
ports:
317318
- "1521"
318319
environment:
@@ -323,7 +324,7 @@ services:
323324
labels:
324325
io.quarkus.devservices.compose.wait_for.logs: .*DATABASE IS READY TO USE.*
325326
mssql:
326-
image: mcr.microsoft.com/mssql/server:2022-latest
327+
image: {mssql-image}
327328
ports:
328329
- "1433"
329330
environment:

docs/src/main/asciidoc/getting-started-dev-services.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ If you like, use your container tool to see what containers are running.
225225
For example, if you're using Docker, run `docker ps`, and for podman, run `podman ps`.
226226
You should see something like the following:
227227

228+
[source,bash,subs=attributes+]
228229
----
229-
ff88dcedd899 docker.io/library/postgres:14 postgres -c fsync... 20 minutes ago Up 20 minutes 0.0.0.0:34789->5432/tcp nostalgic_bassi
230+
ff88dcedd899 {postgres-image} postgres -c fsync... 20 minutes ago Up 20 minutes 0.0.0.0:34789->5432/tcp nostalgic_bassi
230231
----
231232

232233
Stop Quarkus and run `docker ps` again.

docs/src/main/asciidoc/getting-started-reactive.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,12 @@ To run the application, don’t forget to start a database and provide the confi
300300

301301
For example, you can use Docker to run your database:
302302

303-
[source, bash]
303+
[source, bash, subs=attributes+]
304304
----
305305
docker run -it --rm=true \
306306
--name postgres-quarkus -e POSTGRES_USER=quarkus \
307307
-e POSTGRES_PASSWORD=quarkus -e POSTGRES_DB=fruits \
308-
-p 5432:5432 postgres:14.1
308+
-p 5432:5432 {postgres-image}
309309
----
310310

311311
Then, launch the application using:

docs/src/main/asciidoc/getting-started-testing.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ The Testcontainers library usually return connection strings without respecting
13921392

13931393
The following example illustrates the use with PostgreSQL, but the approach is applicable to all containers.
13941394

1395-
[source,java]
1395+
[source,java,subs=attributes+]
13961396
----
13971397
import io.quarkus.test.common.DevServicesContext;
13981398
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
@@ -1417,7 +1417,7 @@ public class CustomResource implements QuarkusTestResourceLifecycleManager, DevS
14171417
@Override
14181418
public Map<String, String> start() {
14191419
// start a container making sure to call withNetworkMode() with the value of containerNetworkId if present
1420-
container = new PostgreSQLContainer<>("postgres:latest").withLogConsumer(outputFrame -> {});
1420+
container = new PostgreSQLContainer<>("{postgres-image}").withLogConsumer(outputFrame -> {});
14211421
14221422
// apply the network to the container
14231423
containerNetworkId.ifPresent(container::withNetworkMode);

docs/src/main/asciidoc/quartz.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ http {
319319

320320
In the root directory, create a `docker-compose.yml` file with the following content:
321321

322-
[source,yaml]
322+
[source,yaml,subs=attributes+]
323323
----
324324
version: '3'
325325
@@ -337,7 +337,7 @@ services:
337337
- postgres
338338
339339
nginx: <2>
340-
image: nginx:1.17.6
340+
image: nginx:latest
341341
volumes:
342342
- ./nginx.conf:/etc/nginx/nginx.conf:ro
343343
depends_on:
@@ -347,8 +347,8 @@ services:
347347
networks:
348348
- tasks-network
349349
350-
postgres: <3>
351-
image: postgres:14.1
350+
db: <3>
351+
image: {postgres-image}
352352
container_name: quarkus_test
353353
environment:
354354
- POSTGRES_USER=quarkus_test

docs/src/main/asciidoc/reactive-sql-clients.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ If you start the application in dev mode, Quarkus provides you with a https://qu
8181
8282
You might also start a database up front:
8383
84-
[source,bash]
84+
[source,bash,subs=attributes+]
8585
----
86-
docker run -it --rm=true --name quarkus_test -e POSTGRES_USER=quarkus_test -e POSTGRES_PASSWORD=quarkus_test -e POSTGRES_DB=quarkus_test -p 5432:5432 postgres:14.1
86+
docker run -it --rm=true --name quarkus_test -e POSTGRES_USER=quarkus_test -e POSTGRES_PASSWORD=quarkus_test -e POSTGRES_DB=quarkus_test -p 5432:5432 {postgres-image}
8787
----
8888
====
8989

docs/src/main/asciidoc/security-getting-started-tutorial.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ You can configure it to use plain text or custom passwords.
308308
* For custom iterations: `BcryptUtil.bcryptHash(password, iterationCount)` where higher iterations (12-14) provide more security but slower performance.
309309
====
310310

311-
- For more information about configuring passwords and roles, see xref:configure-the-application[Configure the application].
311+
- For more information about configuring passwords and roles, see xref:configure-the-application[Configure the application].
312312
- For more information on hashing passwords and available options, see xref:security-jpa.adoc#password-storage-and-hashing[Password storage and hashing].
313313

314314
[NOTE]
@@ -534,11 +534,11 @@ Then, compile and run your application in either JVM or native mode.
534534

535535
=== Start the PostgreSQL server
536536

537-
[source,bash]
537+
[source,bash,subs=attributes+]
538538
----
539539
docker run --rm=true --name security-getting-started -e POSTGRES_USER=quarkus \
540540
-e POSTGRES_PASSWORD=quarkus -e POSTGRES_DB=quarkus \
541-
-p 5432:5432 postgres:17
541+
-p 5432:5432 {postgres-image}
542542
----
543543

544544
=== Compile and run the application

docs/src/main/asciidoc/spring-data-jpa.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ This configuration assumes that PostgreSQL will be running locally.
139139

140140
A very easy way to accomplish that is by using the following Docker command:
141141

142-
[source,bash]
142+
[source,bash,subs=attributes+]
143143
----
144-
docker run -it --rm=true --name quarkus_test -e POSTGRES_USER=quarkus_test -e POSTGRES_PASSWORD=quarkus_test -e POSTGRES_DB=quarkus_test -p 5432:5432 postgres:14.1
144+
docker run -it --rm=true --name quarkus_test -e POSTGRES_USER=quarkus_test -e POSTGRES_PASSWORD=quarkus_test -e POSTGRES_DB=quarkus_test -p 5432:5432 {postgres-image}
145145
----
146146

147147
If you plan on using a different setup, please change your `application.properties` accordingly.

docs/src/main/asciidoc/spring-data-rest.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ This configuration assumes that PostgreSQL will be running locally.
158158

159159
A very easy way to accomplish that is by using the following Docker command:
160160

161-
[source,bash]
161+
[source,bash,subs=attributes+]
162162
----
163-
docker run -it --rm=true --name quarkus_test -e POSTGRES_USER=quarkus_test -e POSTGRES_PASSWORD=quarkus_test -e POSTGRES_DB=quarkus_test -p 5432:5432 postgres:14.1
163+
docker run -it --rm=true --name quarkus_test -e POSTGRES_USER=quarkus_test -e POSTGRES_PASSWORD=quarkus_test -e POSTGRES_DB=quarkus_test -p 5432:5432 {postgres-image}
164164
----
165165

166166
If you plan on using a different setup, please change your `application.properties` accordingly.

0 commit comments

Comments
 (0)