wget -qO- https://get.docker.com/ | sh
General
docker version
docker info
docker history <image_name>
docker inspect <image_name>
Images
docker image ls OR docker images
docker image rm aamirpinger/helloworld:latest
docker pull aamirpinger/helloworld:latest
docker tag <image_name> aamirpinger/<new_name> [copy image_name to aamirpinger/new_name]
View container status
docker container ls OR docker ps
docker container ls -a OR docker ps -a
Running containers from images
docker run -it aamirpinger/helloworld sh [interactive mode]
docker run -d aamirpinger/helloworld [detached mode]
(exit command to exit from container; Ctrl + PQ to keep container running and return to host machine's shell)
docker exec -it <container_ID or name> sh
Start/stop/delete container
docker container stop <container_ID or name>
docker container start <container_ID or name>
docker container rm <container_ID or name>
Publishing Port
docker container run -d -p 5010:80 aamirpinger/helloworld
docker container run -d --name <custom_name> -p 5010:80 aamirpinger/helloworld
Building images
docker build -t <image_name> .
Pushing Images
docker login
docker push aamirpinger/node-tag-image:latest
Bind Mount
docker run -it -v </complete/path/on/host>:</path/inside/container> aamirpinger/helloworld sh