Docker Documentation References:
The intent of this kata is to understand how to update a containers configuration.
In this exercise we will create a container, show the containers stats at runtime, modify its settings, then show the containers stats again. Finally, we will stop and remove the container.
Command
docker run -p 80:80 -d nginx:alpine
Output
/ # docker run -p 80:80 -d nginx:alpine
19d948bb72d5984ae6f167a784bc661fc9ada8bf3706b73d0c52b9c609f85e71
Command
docker stats --no-stream
Output
/ # docker stats --no-stream
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
19d948bb72d5 0.00% 1.676 MiB / 1.952 GiB 0.08% 578 B / 578 B 0 B / 0 B 2
Command
docker update --memory 1Gb --memory-swap 1Gb $(docker ps -aq)
Output
/ # docker update --memory 1Gb --memory-swap 1Gb $(docker ps -aq)
19d948bb72d5
Command
docker stats --no-stream
Output
/ # docker stats --no-stream
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
19d948bb72d5 0.00% 1.656 MiB / 1 GiB 0.16% 648 B / 648 B 0 B / 0 B 2
Command
docker stop $(docker ps -aq)
Output
/ # docker stop $(docker ps -aq)
19d948bb72d5
Command
docker rm $(docker ps -aq)
Output
/ # docker rm $(docker ps -aq)
19d948bb72d5