docker 容器操作
常用
参数 | 描述 |
---|---|
-a,–attach list | Attach to STDIN, STDOUT or STDERR |
-c,–cpu-shares int | CPU shares (relative weight) |
-d,–detach | Run container in background and print container ID |
-e,–env list | Set environment variables |
-h,–hostname string | Container host name |
-i,–interactive | Keep STDIN open even if not attached |
-l,–label list | Set meta data on a container |
-m, --memory bytes | Memory limit |
-p, --publish list | Publish a container’s port(s) to the host |
-P, --publish-all | Publish all exposed ports to random ports |
-t, --tty | Allocate a pseudo-TTY |
-u, --user string | Username or UID (format: <name |
-v, --volume list | Bind mount a volume |
-w, --workdir string | Working directory inside the container |
参数 | 描述 |
---|---|
–name string | Assign a name to the container |
使用
docker container COMMAND
命令 | 描述 |
---|---|
docker container attach | 进入正在运行的容器 |
docker container commit | 保存现在的容器为镜像 |
docker container cp | 拷贝镜像中的稳健 |
docker container create | 创建新的容器 |
docker container diff | Inspect changes to files or directories on a container’s filesystem |
docker container exec | 在指定容器中运行命令 |
docker container export | 导出容器为 a tar archive |
docker container inspect | 查看容器的具体信息 |
docker container kill | Kill one or more running containers |
docker container logs | 查看容器的日志 |
docker container ls | 列出所有容器 |
docker container pause | Pause all processes within one or more containers |
docker container port | 列出所有的端口 |
docker container prune | 删除所有停止的容器 |
docker container rename | 重命名容器 |
docker container restart | 重启容器 |
docker container rm | 删除容器 |
docker container run | Run a command in a new container |
docker container start | Start one or more stopped containers |
docker container stats | Display a live stream of container(s) resource usage statistics |
docker container stop | Stop one or more running containers |
docker container top | Display the running processes of a container |
docker container unpause | Unpause all processes within one or more containers |
docker container update | Update configuration of one or more containers |
docker container wait | Block until one or more containers stop, then print their exit codes |
参考文献:
https://docs.docker.com/engine/reference/commandline/container/#child-commands