← 返回命令列表

Linux command

docker-container 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

List running containers

docker container ls

List all containers including stopped ones

docker container ls -a

Create and run a container interactively

docker container run -it [image] [command]

Run a container in the background

docker container run -d -p [host_port]:[container_port] --name [name] [image]

Start a stopped container

docker container start [container]

Stop a running container

docker container stop [container]

Remove a stopped container

docker container rm [container]

Execute a command in a running container

docker container exec -it [container] [command]

View container logs

docker container logs -f [container]

说明

docker container manages Docker containers. It provides commands for the full container lifecycle: creation, execution, monitoring, and removal. This is the modern syntax; most subcommands also work as direct docker commands (e.g., docker ps = docker container ls).

FAQ

What is the docker-container command used for?

docker container manages Docker containers. It provides commands for the full container lifecycle: creation, execution, monitoring, and removal. This is the modern syntax; most subcommands also work as direct docker commands (e.g., docker ps = docker container ls).

How do I run a basic docker-container example?

Run `docker container ls` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

Where can I find more docker-container examples?

This page includes 9 examples for docker-container, plus related commands for nearby Linux tasks.