[root@localhost home]# docker exec -h
Options:
-d, --detach Detached mode: run commandin the background
--detach-keys string Override the key sequence for detaching a container
-e, --env list Set environment variables (default [])
--help Print usage
-i, --interactive Keep STDIN open even if not attached
--privileged Give extended privileges to the command
-t, --tty Allocate a pseudo-TTY
-u, --user string Username or UID(format: <name|uid>[:<group|gid>])# 示例进入MySQL运行空间[root@localhost home]# docker exec -it mysql-test /bin/bash# -it 表示进入容器终端并且的保留为容器终端的输入形式
删除容器
# 删除所有未运行的容器(已经运行的删除不了,未运行的就一起被删除了)sudodockerrm$(sudodockerps -a -q)