Saturday, 9 May 2020

docker restart: Restart the container

'docker restart' command is used to restart one or more containers.

Syntax
docker restart <container_id>

$docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                           PORTS               NAMES
a523924b741a        jboss/wildfly       "/opt/jboss/wildfly/…"   28 minutes ago      Exited (0) About a minute ago                        silly_cori

As you see the output of above command, container 'a523924b741a' stopped a minute ago. You can restart the container by executing below statement.

docker restart a523924b741a

$docker restart a523924b741a
a523924b741a
$
$docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                           PORTS                    NAMES
a523924b741a        jboss/wildfly       "/opt/jboss/wildfly/…"   34 minutes ago      Up 8 seconds                     0.0.0.0:1234->8080/tcp   silly_cori


Previous                                                    Next                                                    Home

No comments:

Post a Comment