docker container run -it diamol/base
Get details of all running containers:
docker container ls
List the process running in the container:
docker container top <container-id>
Remove all containers:
docker container rm -f $(docker container ls -aq)
Reclaim disk space:
docker image rm -f $(docker image ls -f reference='diamol/*' -q)
docker container run --detach --publish 8088:80 diamol/ch02-hello-diamol-web
View CPU, memory, network and disk usuage:
docker container stats <image-id-from-pervious-command>
Pull the image:
docker image pull diamol/ch03-web-ping
Run a container:
docker container run -d --name web-ping diamol/ch03-web-ping
docker container logs web-ping
docker container logs --tail 4 todo-dev
Use environment variable:
docker container run --env TARGET=google.com diamol/ch03-web-ping
docker system df
From the project root folder, run:
docker image build --tag web-ping .
docker image ls
Images starting with w:
docker image ls 'w*'
Configuration settings can be applied with environment variables:
docker container run -e TARGET=docker.com -e INTERVAL=5000 web-ping
docker image history web-ping
docker image build -t web-ping:v2 .
Order instructions based on the change frequency. Instructions that are unlikely to change are at the start of the Dockerfile.
FROM diamol/node
CMD ["node", "/web-ping/app.js"]
ENV TARGET="blog.sixeyed.com" \
METHOD="HEAD" \
INTERVAL="3000"
WORKDIR /web-ping
COPY app.js .
Rebuild the optimized image:
docker image build -t web-ping:v3 .
Run three instances of iotd:
docker-compose up -d --scale iotd=3