Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/antoine-coulon/running-containerized-apps

A short guide to safely run and manage containerized applications the right way
https://github.com/antoine-coulon/running-containerized-apps

Last synced: 14 days ago
JSON representation

A short guide to safely run and manage containerized applications the right way

Awesome Lists containing this project

README

        

## Running containerized applications

**Please start by reading [BEST-PRACTICES.md](./BEST-PRACTICES.md) which summarizes some of the core principles to respect when running containerized applications.**

## Node.js

All the current examples are using [Node.js](https://github.com/nodejs) but keep in mind that they are valid for most platforms running code.

If anyone is interested in providing other examples for the JVM, Python, Go, Rust... Feel free to submit PRs :)

To follow the article with examples, you can use the three provided Dockerfile.

- `Docker` needs to be up and running on the host machine.

- Use `./nodejs/docker-build.sh` to build the three images: `node-shell-form`, `node-exec-form`, `node-with-tini`.

- Then just `docker run `.

### `node-shell-form`

1. `docker run node-shell-form`
2. Then access the container `docker exec -it node-shell-form /bin/sh`
3. In the container shell, run `ps aux`
4. Observe `/bin/sh` being PID1
5. Run `docker stop `
6. Observe the Node.js script not receiving the SIGTERM signal hence keeping running until Docker sends SIGKILL after 10 seconds.

### `node-exec-form`

1. `docker run node-exec-form`
2. Then access the container `docker exec -it /bin/sh`
3. In the container shell, run `ps aux`
4. Observe `Node.js` being PID1
5. Run `docker stop `
6. Observe the Node.js script receiving the SIGTERM signal hence allowing the graceful shutdown

### `node-with-tini`

1. `docker run node-with-tini`
2. Then access the container `docker exec -it /bin/sh`
3. In the container shell, run `ps aux`
4. Observe `Tini` being PID1
5. Run `docker stop `
6. Observe Tini receiving the SIGTERM signal and forwarding it to Node.js hence allowing the graceful shutdown