Skip to content

My Docker playground examples, written for learning purposes.

License

Notifications You must be signed in to change notification settings

eranshmil/docker-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Docker Examples

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.

What's in the box

Currently, each example uses nodemon for:

  1. Debugging
  2. Watching files and live-reload the app

Usage

  1. Install Docker.

  2. Clone this repository:

    git clone https://github.com/eranshmil/docker-examples.git
  3. Go to the folder you want to use, for example:

    cd express-mongo
  4. Run the following command to create the containers:

     docker-compose up
  5. 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

Standalone services

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

Breakpoint at first line

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"
    }
    ...
}

Debugging with vscode

Todo

  1. Add documentation about parameters used in Dockerfile and docker-compose.yml.
  2. Explain about the first example.
  3. Examples to add:
    • Angular container
    • Laravel container

Resources

  1. Official NodeJS Debugging Guide

About

My Docker playground examples, written for learning purposes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published