zoukankan      html  css  js  c++  java
  • docker重启 容器自动重启

    创建容器时添加参数  --restart=always 后,当 docker 重启时,容器自动启动。

    使用方法:

    docker container update --restart=always 容器名字
    

    操作实例如下:

    [root@localhost mnt]# docker ps -a
    CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS               NAMES
    46cdfc60b7a6        nginx               "nginx -g 'daemon ..."   About a minute ago   Up 42 seconds       80/tcp              n3
    79d55a734c26        nginx               "nginx -g 'daemon ..."   About a minute ago   Up 42 seconds       80/tcp              n2
    f7b2206c019d        nginx               "nginx -g 'daemon ..."   About a minute ago   Up 46 seconds       80/tcp              n1
    [root@localhost mnt]# docker container update --restart=always n1
    n1
    [root@localhost mnt]# systemctl restart docker 
    [root@localhost mnt]# docker ps -a
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES
    46cdfc60b7a6        nginx               "nginx -g 'daemon ..."   2 minutes ago       Exited (0) 5 seconds ago                       n3
    79d55a734c26        nginx               "nginx -g 'daemon ..."   2 minutes ago       Exited (0) 5 seconds ago                       n2
    f7b2206c019d        nginx               "nginx -g 'daemon ..."   2 minutes ago       Up 2 seconds               80/tcp              n1
    

      

  • 相关阅读:
    MySQL 8.0+ 时区问题
    SSM框架整合搭建流程
    最大子段和、最大子矩阵和
    棋盘覆盖(分治)
    石子合并问题
    矩阵连乘
    selenium完成滑块验证
    背包问题(2)
    背包问题(1)
    皇后问题
  • 原文地址:https://www.cnblogs.com/jtlgb/p/12220815.html
Copyright © 2011-2022 走看看