- Build postgresql container from Dockerfile:
- go to the folder docker/db and in terminal type:
$ docker build -t iuccio/postgresql:0.0.1 .
- Run postgresql container
$ docker run -p 5432:5432 -t --name postgres-db -e POSTGRES_PASSWORD=mysecretpassword -d postgres
- Run postgresql container with data persistence
$ docker run -d -p 5432:5432 --name postgres-db -v postgres_data:/var/lib/postgresql/data iuccio/postgresql:0.0.1
- data persistence usefully links:
Remove images, containers, volumes, ...
- Run springboot app container
docker run -p 8080:8080 -t iuccio/springboot
- Run docker-compose:
docker-compose up
The web application is published on http://localhost:8080/
docker build -t iuccio/node-web-app:0.0.1 .
docker run -p 3000:3000 --name node-js-web-app -d iuccio/node-web-app
-p: specifies the port that will expose (e.g. -p 3000:3000 -> localhost:3000)
-d: runs the container in detached modes (background)
--name: gives a name to the running container
docker logs <container-id>
docker exec -it <container-id> /bin/bash