You can view statistics for container(s) using the docker stats
command.
For example;
docker stats containera containerb
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
containera 0.00% 24.15 MB / 1.041 GB 2.32% 1.8 MB / 79.37 kB 0 B / 81.92 kB
containerb 0.00% 24.95 MB / 1.041 GB 2.40% 1.798 MB / 80.72 kB 0 B / 81.92 kB
Or, see processes running in a container using docker top <container>
docker top containera
UID PID PPID C STIME TTY TIME CMD
root 4558 2850 0 21:13 ? 00:00:00 sh -c npm install http-server -g && mkdir -p /public && echo "welcome to containera" > /public/index.html && http-server -a 0.0.0.0 -p 4200
root 4647 4558 0 21:13 ? 00:00:00 node /usr/local/bin/http-server -a 0.0.0.0 -p 4200
Limiting resources
Docker compose (like docker itself) allows you to set limits on resources for a container, for example, limiting the maximum amount of memory used, cpu-shares, etc.
Read this section in the docker-compose yaml reference, and the docker run reference on "Runtime constraints on resources"