Id | Description | Command | Example |
---|
1 | Verify installation Docker version | docker --version | |
2 | View a list of running containers | docker ps || docker container ls | |
3 | See a list of Docker images | docker image ls | |
4 | To pull an image | docker pull <image name> | docker pull nginx |
5 | Detached mode | docker run -d <image name> | docker run -d nginx:latest |
6 | Exposing ports | docker run -d -p <port>:<port> <image> | docker run -d -p 8080:80 nginx:latest |
7 | Start the container | docker start <container name> | docker start silly_blackburn |
8 | Removing Containers | docker rm <container name or id> | docker rm b480882ff475 |
9 | List all containers IDs | docker ps -aq | |
10 | Remove all containers in one single command | docker rm $(docker ps -aq) | |
11 | Force Remove running Containers | docker rm -f $(docker ps -aq) | |
12 | Naming Containers | docker run --name todoapp -d -p 8080:80 nginx:latest | |
13 | Exposing Multiple Ports | docker run -d -p 8080:80 -p 3000:80 nginx:latest | |
14 | To start the container | docker start <container id > or <container name> | docker start silly_blackburn |
15 | Stop a container | docker stop silly_blackburn | |
16 | Docker Volume | docker run --name website -v $(pwd):/usr/share/nginx/html:ro -d -p 8080:80 nginx | |
17 | Login to Docker | docker login | |
18 | Debug Docker | docker inspect <container id> | docker inspect 121217834 |
19 | View logs for containers | ocker logs <container id> | |
20 | Get into bash interactive shell | docker exec -it container-id /bin/bash | |
21 | Push into a registry | docker push nodeapp:1 | |
22 | Pull images | docker pull <image>:<version> | docker pull node:lts-alpine |
23 | Naming Containers | docker run --name todoapp -d -p 8080:80 nginx:latest | |
24 | Building images from docker file | docker build <--tag or -t > <name:version> <where is your docker file> | docker build --tag website:latest . |