IdDescriptionCommandExample
1Verify installation Docker versiondocker --version
2View a list of running containersdocker ps || docker container ls
3See a list of Docker imagesdocker image ls
4To pull an imagedocker pull <image name>docker pull nginx
5Detached modedocker run -d <image name>docker run -d nginx:latest
6Exposing portsdocker run -d -p <port>:<port> <image>docker run -d -p 8080:80 nginx:latest
7Start the containerdocker start <container name>docker start silly_blackburn
8Removing Containersdocker rm <container name or id>docker rm b480882ff475
9List all containers IDsdocker ps -aq
10Remove all containers in one single commanddocker rm $(docker ps -aq)
11Force Remove running Containersdocker rm -f $(docker ps -aq)
12Naming Containersdocker run --name todoapp -d -p 8080:80 nginx:latest
13Exposing Multiple Portsdocker run -d -p 8080:80 -p 3000:80 nginx:latest
14To start the containerdocker start <container id > or <container name>docker start silly_blackburn
15Stop a container docker stop silly_blackburn
16Docker Volumedocker run --name website -v $(pwd):/usr/share/nginx/html:ro -d -p 8080:80 nginx
17Login to Dockerdocker login
18Debug Dockerdocker inspect <container id>docker inspect 121217834
19View logs for containersocker logs <container id>
20Get into bash interactive shelldocker exec -it container-id /bin/bash
21Push into a registrydocker push nodeapp:1
22Pull imagesdocker pull <image>:<version>docker pull node:lts-alpine
23Naming Containersdocker run --name todoapp -d -p 8080:80 nginx:latest
24Building images from docker filedocker build <--tag or -t > <name:version> <where is your docker file>docker build --tag website:latest .