The Objective of this workshop is to create a Dockerfile for your webapp and run it alongside your database using Docker Compose
-
Install Docker on your local machine https://docs.docker.com/engine/install/
-
The repository contains sample Docker files for an application
-
Use the respective Dockerfile and modify it according to your application
-
Build the docker image using the following command:
docker build -t <image-name> .
- Run the docker image using the following command to test the application locally:
# ensure to change the port mapping according to your application
# you can also use the --env-file flag to pass environment variables to the container
docker run --env-file .env -d -p 8080:8080 <image-name>
-
After testing the application locally, select a docker compose file and modify the environment variables according to your application
-
Run the docker compose file using the following command:
docker-compose -f <docker-compose-file> up
- The Application should be running locally and it should be connected to your database running in a separate container