docker使用技巧
docker exec 和 docker run的区别
- The difference between “docker run” and “docker exec” is that “docker exec” executes a command on a running container. On the other hand, “docker run” creates a temporary container, executes the command in it and stops the container when it is done.
译:区别在于exec是在一个已有的容器上执行一个命令,run是创建一个临时容器,并在其上执行一个命令
docker run -it ubuntu:18.04 bash
docker exec -it 74f86665f0fd bash