Skip to content

Commit

Permalink
improve section on docker
Browse files Browse the repository at this point in the history
  • Loading branch information
donsez committed Nov 8, 2024
1 parent eeea0fe commit 2024afd
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions jdbc-postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,27 +216,40 @@ git diff pom.xml

https://www.baeldung.com/jib-dockerizing

> You should have an account on https://hub.docker.com

```bash
export DOCKERHUB_USER=$USER
export IMAGE_PATH=registry.hub.docker.com/$DOCKERHUB_USER/jdbc-jib-app
docker login
mvn compile com.google.cloud.tools:jib-maven-plugin:build -Dimage=$IMAGE_PATH
docker pull $DOCKERHUB_USER/jdbc-jib-app
mvn compile com.google.cloud.tools:jib-maven-plugin:dockerBuild
```

Run the container containing the application
```bash
docker run --rm $DOCKERHUB_USER/jdbc-jib-app
docker run --rm jdbc-postgresql:0.1.0-SNAPSHOT
```

What's happen ? Why ?

Run the container containing the application
```bash
docker run --rm --network host jdbc-postgresql:0.1.0-SNAPSHOT
```

For publishing the image on https://hub.docker.com

> You should have an account on https://hub.docker.com
```bash
export DOCKERHUB_USER=$USER
export IMAGE_PATH=registry.hub.docker.com/$DOCKERHUB_USER/jdbc-postgresql
docker login
mvn compile com.google.cloud.tools:jib-maven-plugin:build -Dimage=$IMAGE_PATH
docker pull $DOCKERHUB_USER/jdbc-postgresql
```

Re-Run the container containing the application
```bash
docker run --rm --network host $DOCKERHUB_USER/jdbc-jib-app
docker run --rm --network host $DOCKERHUB_USER/jdbc-postgresql
```


## References
* https://jdbc.postgresql.org/documentation/use/

0 comments on commit 2024afd

Please sign in to comment.