首页  

docker run 与 start的区别     所属分类 docker 浏览量 1436
docker run 相当于执行了两步操作
docker create 将镜像放入容器中
docker start 启动容器


docker ps -a
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS                     PORTS               NAMES
b066035925b6        hello-world         "/hello"               12 minutes ago      Exited (0) 4 minutes ago                       friendly_shockley
6d8a0d9e82b2        ubuntu              "echo 'hello world'"   14 hours ago        Exited (0) 14 hours ago                        quizzical_goldberg

docker ps -a -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
b066035925b6        hello-world         "/hello"            13 minutes ago      Exited (0) 4 minutes ago                       friendly_shockley


根据 容器id 或 name 启动容器
docker start b066035925b6
docker start friendly_shockley

使用 docker logs  日志

docker logs b066035925b6 |grep 'Hello from Docker!' |wc -l


docker logs friendly_shockley |grep 'Hello from Docker!' |wc -l


容器重命名 
docker rename  old_name new_name

docker rename  friendly_shockley myhello

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
b066035925b6        hello-world         "/hello"            16 minutes ago      Exited (0) 55 seconds ago                       myhello

docker start myhello

docker logs myhello |grep 'Hello from Docker!' |wc -l

上一篇     下一篇
Docker和K8S

docker安装和使用

docker设置镜像仓库

docker commit命令使用

使用Dockerfile定制镜像

GC性能度量指标