My Docker playground examples, written for learning purposes.
Tested on MacOS, so feel free to open a PR if you are using another platform.
Warning: may not be suitable for production use.
Currently, each example uses nodemon for:
- Debugging
- Watching files and live-reload the app
-
Install Docker.
-
Clone this repository:
git clone https://github.com/eranshmil/docker-examples.git
-
Go to the folder you want to use, for example:
cd express-mongo
-
Run the following command to create the containers:
docker-compose up
-
When you finish developing, run:
docker-compose down
-
If you have some issue, try to run the container with the build flag:
docker-compose up --build
Running only one service in the container:
docker-compose run --service-ports mongo
- In this example, the service called mongo
- The service-ports flag publishes the service ports to the host machine
In order to debug the initialization process of your app, change the --inspect flag to --inspect-brk in the relevant package.json.
For example:
{
...
"scripts": {
...
"watch": "nodemon -L --inspect-brk=0.0.0.0"
}
...
}
- Add documentation about parameters used in Dockerfile and docker-compose.yml.
- Explain about the first example.
- Examples to add:
- Angular container
- Laravel container