docker exec

exec

Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

Run a command in a running container

  -d, --detach               Detached mode: run command in the background
  --detach-keys              Specify the escape key sequence used to detach a container
  --help                     Print usage
  -i, --interactive          Keep STDIN open even if not attached
  --privileged               Give extended Linux capabilities to the command
  -t, --tty                  Allocate a pseudo-TTY
  -u, --user=                Username or UID (format: <name|uid>[:<group|gid>])

The docker exec command runs a new command in a running container.

The command started using docker exec only runs while the container’s primary process (PID 1) is running, and it is not restarted if the container is restarted.

If the container is paused, then the docker exec command will fail with an error:登录查看完整内容