• docker服务器以及容器设置自动启动


    一、docker服务设置自动启动

    说明:适用于yum安装的各种服务

    查看已启动的服务

    systemctl list-units --type=service

    查看是否设置开机启动

    systemctl list-unit-files | grep enable

    设置开机启动

    systemctl enable docker.service

    关闭开机启动

    systemctl disable docker.service

    二、docker容器设置自动启动

    启动时加--restart=always

    docker run -tid --name isaler_v0.0.11 -p 8081:8080 --restart=always -v /alidata/iDocker/run/projectImages/logs pda
    
    
    Flag	Description
    no		不自动重启容器. (默认value)
    on-failure 	容器发生error而退出(容器退出状态不为0)重启容器
    unless-stopped 	在容器已经stop掉或Docker stoped/restarted的时候才重启容器
    always 	在容器已经stop掉或Docker stoped/restarted的时候才重启容器

    如果已经过运行的项目

    如果已经启动的项目,则使用update更新:
    docker update --restart=always pda
  • 相关阅读:
    Tomcat组件
    Tomcat介绍
    Varnish的VCL
    varnish的架构和日志
    Varnish介绍
    HAProxy的配置
    HAProxy介绍
    KeepAlived的实现示例
    KeepAlived的配置
    vue2.0填坑有感(持续更新ing)
  • 原文地址:https://www.cnblogs.com/zyb2016/p/13432964.html
Copyright © 2020-2023  润新知