zoukankan      html  css  js  c++  java
  • docker run 命令

    docker run 命令


    Detached (-d)
    To start a container in detached mode, you use -d=true or just -d option. By design, containers started in detached mode exit when the root process used to run the container exits, unless you also specify the --rm option. If you use -d with --rm, the container is removed when it exits or when the daemon exits, whichever happens first.

    Do not pass a service x start command to a detached container. For example, this command attempts to start the nginx service.

    $ docker run -d -p 80:80 my_image service nginx start
    This succeeds in starting the nginx service inside the container. However, it fails the detached container paradigm in that, the root process (service nginx start) returns and the detached container stops as designed. As a result, the nginx service is started but could not be used. Instead, to start a process such as the nginx web server do the following:

    $ docker run -d -p 80:80 my_image nginx -g 'daemon off;'
    To do input/output with a detached container use network connections or shared volumes. These are required because the container is no longer listening to the command line where docker run was run.

    To reattach to a detached container, use docker attach command.

    andycja
  • 相关阅读:
    c++构造函数析构函数调用顺序
    c++隐藏实例
    c++子类和父类成员函数重名
    C++虚函数·
    c/c++字符数组和字符串大揭秘
    python 基础回顾 一
    python java scala 单例模式
    推荐一款好用并且免费的markdown软件 Typora
    java 的垃圾回收机制 【转】
    python的垃圾回收机制【转】
  • 原文地址:https://www.cnblogs.com/andycja/p/14320771.html
Copyright © 2011-2022 走看看