Docker is an open platform for developers and sysadmins to build,ship and run distributed applications
Docker’s philosophy is “build->ship->run”.
In contemporary IT industry, there are two major usage of
- Focus on Build & Ship, to leverage Docker to setup a platform of “CI/CD”, for develop, test enviornment.
- Make use of Docker as light weight VM (virtual machine), focus on
Run, apply it in large scale production environment.
the access control in docker is rely on iptables, the firewall software shipped in almost all Linux release.
List all images
remove all exited containers
docker rm $(docker ps -a -f status=exited -q)
docker run IMAGE_NAME [COMMAND]
docker run -t -i f2d8ce9fa988 /bin/bash
View docker details, e.g. start up script, working dir
docker inspect containerid
Start bash to view files inside docker
docker -t -i imageFile /bin/bash
Map hosts between host and contains
docker -P xxx
docker ps -l
It means host port 32768 map to port 5000 in contains
To list docker containers including histories
docker ps -a
docker ps -l
removes containers once return from one run
docker run --rm -name myApp1 -link db:db training/webapp env
to ping other containers
Be advised there is no built-in ping for containers, therefore it’s requried manually install one. As following sample:
apt-get install -yqq inetutils-ping