1.docker start介绍

docker start命令是用来启动一个或多个已经被停止的docker容器。

2.docker start用法

docker start [参数] container [container......]

[root@centos79 ~]# docker start --help

Usage:  docker start [OPTIONS] CONTAINER [CONTAINER...]

Start one or more stopped containers

Aliases:
  docker container start, docker start

Options:
  -a, --attach               Attach STDOUT/STDERR and forward signals
      --detach-keys string   Override the key sequence for detaching a container
  -i, --interactive          Attach container's STDIN
[root@centos79 ~]#

3.实例

3.1.启动停止的docker容器

命令:

docker start Container_Id

[root@centos79 ~]# docker ps -a |grep -i exited
20cebbe3fac3   daocloud.io/library/centos:latest   "/bin/bash"               2 days ago    Exited (0) 2 days ago                                                                                          centos-ztj
[root@centos79 ~]# docker start 20ce
20ce
[root@centos79 ~]# docker ps -a |grep -i 20ce
20cebbe3fac3   daocloud.io/library/centos:latest   "/bin/bash"               2 days ago    Up 8 seconds                                                                                              centos-ztj
[root@centos79 ~]# docker exec -it 20ce /bin/bash
[root@20cebbe3fac3 /]# hostname
20cebbe3fac3
[root@20cebbe3fac3 /]#