Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/charles-dr/docker-node-mongo-example
https://github.com/charles-dr/docker-node-mongo-example
cicd container containerization docker dockercompose dockerswarm example githubaction-workflow image mongodb nodejs volume
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/charles-dr/docker-node-mongo-example
- Owner: charles-dr
- Created: 2021-10-03T03:21:18.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-03T05:17:18.000Z (about 3 years ago)
- Last Synced: 2024-10-12T12:24:00.747Z (3 months ago)
- Topics: cicd, container, containerization, docker, dockercompose, dockerswarm, example, githubaction-workflow, image, mongodb, nodejs, volume
- Language: JavaScript
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node JS app with Docker
[Reference](https://docs.docker.com/language/nodejs/build-images)
## Requirements
- Node.js version 12.18 or later. (16.5.0)
- Docker running locally.
- An IDE or a text editor to edit files. We recommend using Visual Studio Code.## CMD
- docker run
docker run -it --rm -d -v mongodb:/data/db -v mongodb_config:/data/configdb -p 27017:27017 --network mongodb --name mongodb mongo
docker run -it --rm -d --network mongodb --name rest-server -p 8000:8000 -e CONNECTIONSTRING=mongodb://mongodb:27017/yoda_notes node-docker
### Image
- build image
```
docker build --tag node-docker .
```- tag image
```
docker tag node-docker:latest node-docker:v1.0.0
```- list images
```
docker rmi node-docker:latest
```### Container
- run
```
docker run -d -p 80:80 image-name --name container-name
```- list containers
```
docker ps -a
```- start/stop/restart container
```
docker [start/stop/restart/rm] container-name
```### Volume
- create
```bash
docker volume create volume-name
```### Compose
- Run
```
docker-compose -f docker-compose.dev.yml up --build
```