docker exec
时间: 2023-10-21 17:37:42 浏览: 45
"docker exec" is a command used in Docker to execute a command inside a running container. It allows a user to run a command or script within the context of the container, without having to start a new container. The command takes the form:
docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Where:
- [OPTIONS] are additional options for the command, such as "-it" to run the command interactively.
- CONTAINER is the name or ID of the container to execute the command in.
- COMMAND is the command or script to run inside the container.
- [ARG...] are any additional arguments to pass to the command.
For example, to run a command "ls" inside a container named "my-container", the command would be:
docker exec -it my-container ls
This would execute the "ls" command inside the "my-container" container and display the output to the terminal in an interactive mode.