?
本文檔使用 php中文網(wǎng)手冊 發(fā)布
Usage: exec [options] SERVICE COMMAND [ARGS...] Options: -d Detached mode: Run command in the background. --privileged Give extended privileges to the process. -u, --user USER Run the command as this user. -T Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY. --index=index index of the container if there are multiple instances of a service [default: 1]
這相當于docker exec
。使用此子命令,您可以在服務(wù)中運行任意命令。命令默認分配一個 TTY ,所以你可以做例如docker-compose exec web sh
獲得交互式提示。