markdown [Docker] Docker片段列表和命令#linux #docker #snippets
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown [Docker] Docker片段列表和命令#linux #docker #snippets相关的知识,希望对你有一定的参考价值。
**Inspect Image**
```
docker inspect image <imageId>
```
**information about the docker**
```
docker info
```
**current logging driver**
```
docker info | grep "Logging"
```
**add User into docker group**, Now, user can user docker commands without sudo.
```
sudo usermod -aG docker $USER
```
**List Docker CLI commands**
```
docker
```
```
docker container --help
```
**Display Docker version and info**
```
docker --version
```
```
docker version
```
```
docker info
```
**Execute Docker image**
```
docker run hello-world
```
**List Docker images**
```
docker image ls
```
**List Docker containers (running, all, all in quiet mode)**
```
docker container ls
```
```
docker container ls --all
```
```
docker container ls -aq
```
**View Docker nodes**
```
docker node ls
```
**Create a worker node**
```
docker swarm join-token worker
```
**Create a Manager node **
```
docker swarm join token manager
```
**create services into multiple nodes**
```
docker service create --name webapp --replicas=6 nginx
```
this will create Task:WebApp in Container: nginx
| Node | Node | Node |
|--------|--------|--------|
| WebApp | WebApp | WebApp |
| WebApp | WebApp | WebApp |
**list docker services**
```
docker service ls
```
**Lock the swarm cluster with autolock**
```
docker swarm init --autolock
```
**Enable auto lock on exisisting swarm cluster**
```
docker swarm update --autolock=true
```
**list docker stack**
```
docker stack ls
```
**list containers in a stack**
```
docker stack ps mystack
```
**modify replicas in a service**
```
docker service update --replicas=20 <stack_name>
```
**image history**
```
docker image history <image id>
```
以上是关于markdown [Docker] Docker片段列表和命令#linux #docker #snippets的主要内容,如果未能解决你的问题,请参考以下文章
markdown Docker - 有用的Docker命令
markdown [Docker命令]删除容器等#docker
markdown [Docker Cheat Sheet] #docker
markdown docker:docker命令要点
denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock.......(代码片
denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock.......(代码片