“With Docker, developers can build any app in any language using any toolchain. “Dockerized” apps are completely portable and can run anywhere - colleagues” OS X and Windows laptops, QA servers running Ubuntu in the cloud, and production data center VMs running Red Hat.

Basic Commands

Verified cli can talk to engine

docker version

Most config values of engine

docker info
docker ps #see al docker running
docker top <name> #see info about the container

Docker command line structure

docker <command> (options) #old (still works)
docker <command> <sub-command> (options) #new

Deploy a nginx server

docker container run --publish 80:80 nginx

List all container running

docker container ls <options>
SyntaxDescription
–all, -aShow all containers (default show running)
–filter, -fFilter output based on conditions
–formatPretty-print containers using Go templates
–last, -nShow n last creates containers
–latest, -lShow the latest created container
–no-truncDont truncate output
–quiet, -qOnly display container ids
–size, -sDisplay total file sizes

Stop the container process but not remove it

docker container stop <id>

Assign a name to a container

docker container run --publish 80:80 --name webhost nginx

Show logs for a specific container

docker container logs 

Remove many containers together

docker container rm <id> <id> <id> -f #use f for stop the container before